Which alias do you prefer?

liunx

Guest
There is a function(or language construct) in PHP called exit(). You may read about it here: <!-- m --><a class="postlink" href="http://www.php.net/manual/en/function.exit.php">http://www.php.net/manual/en/function.exit.php</a><!-- m -->
Basically, void exit ( [string status]) prints the status string, and then terminates the execution of the script. The status can also be an error code, i.e. an integer.
However, there is an alias for this function, called die(), which does the exact same thing. Only the names differ.

But on to the question, and this is one of the most debated and most important issues in modern PHP programming; Which is the proper alias to use? Is it exit()? Or die()? Are there situations where the other fits better than the other? Or maybe it doesn't matter? I am intrigued to hear your thoughts on this!i use die because i like the way it sounds
executethiscommand() or die();oh I see this poll got far. :P

Rydberg, if you want to get technical exit is less to type.

exit;
die();

see :)

I have never seen "die;"well, youre supposed to put an error message in the () for die like die("you are stupid and dont know how to program")no kidding.

I just said I never seen it without the () on it. I have nver seen die; I have always seen die("text");hehe, well it was quite the sarcastic poll.
and I agree with n8thegreat, it's proper to enter the error :POh, and if you want to get technical, die; works just fine.again, I have not seen anybody use that that way, everOriginally posted by scoutt


exit;
die();



So what you're saying with your example, is that you'd write exit;, but you wouldn't write die; because you've never seen it? You'd write die(); jsut because you've never seen die;? Odd, but to each his own.you say to each there own, well as far as I have seen it seems to be a standard to use exit; and then die("text"); if you want to go against standard then be my guess.

I very rarely see, in any program, where people would use exit("text"); but you see die("text"); all the time.
 
Back
Top