1. die() is a built-in function of PHP. Used to print messages and exit the current php script.
Equivalent to the exit() function in PHP.
2. The die() function only accepts one parameter, not a parameter that must be transmitted. The $message parameter represents the message printed when exiting the script.
Note that die() has no return value, but prints the given information when exiting the script.
This function is applicable to all versions of PHP4 and above.
grammar
die($message)
Example
<?php header(content-type:text/html;charset=utf-8); $a = 1; $b = 9; echo $a; // output 1 die; //Abort the script, the following will not run anymore $sum = $a + $b; echo $sum; // Not output?>
The above is the use of die function in php, I hope it will be helpful to everyone.