Current Location: Home> Function Categories> die

die

Equivalent to exit()
Name:die
Category:Miscellaneous
Programming Language:php
One-line Description:an alias for exit().

Definition and usage

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

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

Example

Print a message and terminate the current script:

 <?php
$site = "http://www.gitbox.net/" ;
fopen ( $site , "r" )
or die ( "Unable to connect to $site " ) ;
?>

grammar

 die ( message )
parameter describe
message

Required. The message or status number to be printed before termination of the script.

The status number is not written to the output, but is only used as an exit status.

illustrate

If message is a string, the function outputs the string before exiting.

If message is an integer, this value will be used as the exit status. The value of the exit status is between 0 and 254. Exit status 255 is reserved by PHP and will not be used. Status 0 is used to successfully terminate the program.

Similar Functions
Popular Articles