note 61987 added to function.exit
| From: | RoumenSemov at osu1 dot php dot net | Date: | Thu, 16 Feb 2006 19:54:34 +0000 |
| Subject: | note 61987 added to function.exit | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-103857@lists.php.net to get a copy of this message | ||
Please note in PHP "exit(0)" or simply "exit" returns true.
Any other value but zero will return false. This is good to know in case you are writing
command-line php scripts where you need the result of the php script to determine if the next script
will run. Example:
shell> ./my_php_script && echo "It ran successfully!"
If you know my_php_script can break somewhere you could do a conditional with an
"exit(-1)" and then if the script breaks the command after the && will not
execute.
----
Server IP: 216.194.113.175
Probable Submitter: 38.118.147.227
----
Manual Page -- http://www.php.net/manual/en/function.exit.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61987
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61987&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61987&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61987&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61987&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61987&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61987&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61987&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61987&report=yes
Search -- http://master.php.net/manage/user-notes.php