Many PHP developers are been asked this question in interview. But many times they are not sure about answer.
There is no difference between die() and exit() function. They both are same and worked same.
Again question is why php keep the both functions if they are same. Both functions are alias of each other function.
Due to API and keeping the backward compatibility both functions are kept.
Here is one more example:
is_int() and is_integer() are also same.
There are quite a few functions in PHP which you can call with more than one name. In some cases there is no preferred name among the multiple ones, is_int() and is_integer() are equally good for example. However there are functions which changed names because of an API cleanup or some other reason and the old names are only kept as aliases for backward compatibility. It is usually a bad idea to use these kind of aliases, as they may be bound to obsolescence or renaming, which will lead to unportable script. This list is provided to help those who want to upgrade their old scripts to newer syntax.
Full list of Aliases function you will find on following URL:
http://php.net/manual/en/aliases.php






Pingback: What is difference between die and exit in php | Wordpressapi.com … | Programming Blog Imagik.org
Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.
Im not going to say what everybody else has by now stated, but I do wish to comment on your information from the topic. Youre genuinely well-informed. I cant believe how much of this I just wasnt conscious of. Thank you for bringing far more data to this subject for me. Im actually grateful and truly impressed.