X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

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

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook