Something that I think is really strange is happening when I use die(). The following code produces no output:
die($test);
However, the following code does output the integer value stored in $test:
die('test: ' . $test);
Why on earth would that be?
die is the same as exit, and since $test is an integer, you’re calling exit with an integer argument. In your second version, you’re creating a string, which results in the string being displayed.
Have a look at this:
http://www.php.net/manual/en/function.exit.php
“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.”