Latest web development tutorials
 

PHP die() Function

< PHP Misc Reference

Example

Print a message and exit the current script:

<?php
$site = "http://www.w3ii.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