PHP die() Function

• Using die( ) function we can check all possible error conditions before starting the 
execution of some code. 
• Print a message and exit the current script 

Syntax :-

die(message)

• where message : mandatory and Specifies the message or status number to write 
before exiting the script. The status number will not be written to the output. 

Example 

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

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post