PHP exit()Functions
Examples
Output a message and exit the current script:
<?php
$site = "http://www.w3cschool.cc/";
fopen($site,"r")
or exit("Unable to connect to $site");
?>
$site = "http://www.w3cschool.cc/";
fopen($site,"r")
or exit("Unable to connect to $site");
?>
Definition and Usage
The exit() function outputs a message and exits the current script.
This function isdie()an alias of the function.
Syntax
exit(message)
| Parameters | Description |
|---|---|
| message | Required. Specifies the message or status number to write before exiting the script. The status number will not be written to the output. |
Technical Details
| Return value: | No return value. |
|---|---|
| PHP Version: | 4+ |
PHP Misc Reference Manual Other Extensions