THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

PHP exit() Function

PHP Misc Reference PHP Misc Reference

Example

Print a message and exit the current script:

<?php
$site = "http://www.w3schools.com/";
fopen($site,"r")
or exit("Unable to connect to $site");
?>


Definition and Usage

The exit() function prints a message and exits the current script.

This function is an alias of the die() function.


Syntax

exit(message)

Parameter 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 value is returned
PHP Version: 4+

PHP Misc Reference PHP Misc Reference