Home >> PHP >> Difference between exit and die in PHP

Difference between exit and die in PHP

exit()-exit() function used to immediatly terminating the script execution.

Example

if($var!=$var1){

     echo "Access denied";

     exit();

}

die()-die() function used to immediatly terminating the script execution.this is alias of exit().

Example

if($var!=$var1){

     echo "Access denied";

     die();

}

Post Your Comment

Next Questions
Set Cookie
Access Cookie
Remove Cookie
how to remove \r\n from string
how to remove new lines from string
how to remove nbsp from string
How to remove all whitespace from a string
How to convert array to string separated by comma
How to list last 12 months from current month
Get the last 12 months from current month
How to list last 6 months from current month
Get the last 6 months from current month
How to list last 12 months from current month by loop
Get the last 12 months from current month by loop
How to list last 6 months from current month by loop
Get the last 6 months from current month by loop
Differentiate between variables and constants
How to increase maximum execution time
How to Increase File Upload Size
Set maximum execution time
Set maximum execution time unlimited
What are the rules for naming a variable
How can you compare objects
Some of the popular frameworks
How to concatenate two strings

Copyright ©2022 coderraj.com. All Rights Reserved.