in PHP Does die()
gives anything in return when we use it?
views:
888answers:
7In PHP the function die() just quit running the script and prints out the argument (if there's any).
Why don't you have a look at the wonderful documentation of PHP? It even contains information about die()
It does not return. The script is terminated and nothing else is executed.
It is the same as exit() and according to documentation it returns nothing
There's no reason to return something in die/exit. This function terminates php interpreter process inside and returns exit-code to shell. So after calling die() there is no script execution as far as there is no interpreter process which executes the script and that's why there is no way to handle function's return.
I have tried this and it worked in google chrome and FF, but not so good in IE7/8
if (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] ) { die("" . include ("empty.php") . ""); }
Basically, a form is filled out asking for username, password and verify password.. if the person filling in the registration form does not fill out all the fields in the form the die function calls empty.php using the include function.
To be honest, Im not sure its actually supposed to work like this, but it seems to. So maybe someone can work from that to find a proper solutions to calling something with the die function.