PHP die() Function
Example
Print a message and terminate the current script:
<?php
$site = "https://www.w3schools.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
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.