PHP die() Function
Example
Print a message and terminate the current script:
<?php
$site = "https://w3.p2hp.com/";
fopen($site,"r")
or die("Unable to connect to $site");
?>
Definition and Usage
The die() function is an alias of the exit() function.
Syntax
die(message)
Parameter Values
Parameter | Description |
---|---|
message | Required. A message or status number to print before terminating the script. A status number will not be written to the output, just used as the exit status. |
Technical Details
Return Value: | Nothing |
---|---|
PHP Version: | 4+ |
❮ PHP Misc Reference