exit
Description
The exit of Miscellaneous for PHP 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 int, 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
<? $status = "string"; exit($status); echo "no output";
string
3 · status · int
<? // decimal exit(0); exit(1); exit(254); // octal exit(0000); exit(0001); exit(0570); echo "no output";
4
<? $filename = "https://osbo.com"; $mode = "r"; $handle = fopen($filename, $mode); if($handle === false) { exit(); } fclose($handle);