exit
Description
Output a message and terminate the current script
Syntax
exit ([ string $status ] ) : void
exit ( int $status ) : void
Parameters
status
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.
Return
No value is returned.
Examples
1 · void
<? exit; exit(); echo "no output"; ?>
2 · status · string
<? exit("exit"); echo "no output"; ?>
exit
3 · status · int
<? // decimal exit(0); exit(1); exit(254); // octal exit(0000); exit(0001); exit(0570); echo "no output"; ?>
4 · 1
<? $filename = "https://404.osbo.com"; $mode = "r"; $handle = fopen($filename, $mode); if ($handle === false) { exit(); } fclose($handle); ?>