Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integer is not being shown as die() argument?

I have this strange problem. When debugging, I have sometimetimes code looking like this

<?php
$var = 15;
die($var);

die() function works, but outputs nothing

However, this one works

<?php
$var = 15;
die($var."<-");

http://sandbox.phpcode.eu/g/81462.php

How is it possible? Did I miss something? or is it bug?

like image 875
genesis Avatar asked Aug 02 '11 14:08

genesis


1 Answers

See http://www.php.net/manual/en/function.exit.php (die() is equivalent to exit())

If status is a string, this function prints the status just before exiting.

If status is an integer, that value will be used as the exit status and not printed. Exit statuses should be in the range 0 to 254, the exit status 255 is reserved by PHP and shall not be used. The status 0 is used to terminate the program successfully.

like image 113
Anton Avatar answered Oct 16 '22 07:10

Anton