September 2001
Intermediate to advanced
768 pages
32h 45m
English
void exit([mixed return_value]) Exits the current script.
Returns:
Null
Description:
exit() is used to stop the execution of the current script. If an argument is passed to exit(), this value is returned by the script when it exits. See the following
examples.
Availability:
UNIX/Linux, Windows
Version:
3+, 4+
See also:
To exit the current script and display a message:
die()
Examples:
<?php
$file = 'some-nonxistent-file.txt';
$fp = fopen ($file, 'r')
or exit ();
?>
|
// Save this script and then run it from the command line // i.e. php -f exit.php // Alternatively, call the script from within another PHP script // using the program execution functions // ... |
Read now
Unlock full access