THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

PHP die() 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 die("Unable to connect to $site");
?>


Definition and Usage

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

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


Syntax

die(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