Home > PHP > Function > Misc. > exit()

exit()

exit - Output a message and terminate the current script

Syntax

exit (string $status, int $status, string $status, int $status)

Arguments

  • status - If status is a string, this function prints the status just before exiting. If status is an integer, that value will also be used as the exit status. 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. Note: PHP >= 4.2.0 does NOT print the status if it is an integer.
  • status
  • status - If status is a string, this function prints the status just before exiting. If status is an integer, that value will also be used as the exit status. 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. Note: PHP >= 4.2.0 does NOT print the status if it is an integer.
  • status

Description

Terminates execution of the script. Shutdown functionsand object destructorswill always be executed even if exit() is called.

Version

PHP 4, 5

Return value

No value is returned.