note 116906 deleted from function.die by salathe
| From: | salathe@php.net | Date: | Thu, 19 Mar 2015 10:46:44 +0000 |
| Subject: | note 116906 deleted from function.die by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-201984@lists.php.net to get a copy of this message | ||
Note Submitter: contact [at] johnmaguire [period] me
----
The Anonymous user who suggested that die() is not an alias of exit() due to the fact that exit()
takes an exit code, and die() takes an error string is incorrect -- in fact, both can take an exit
code OR a string.
If you pass in an exit code, the script will exit without outputting a message, with the exit code
given.
If you pass in a message instead, the script will exit outputting the message, with an exit code of
0.
In other words, the choice is up to you, but it's probably safer in most circumstances to
simply echo your string, and exit with the intended exit code (or none for 0.)