what are the differences in die() and exit() in PHP?
I guess the main question is what is the difference between the 3 exactly?
What is the correct semantic usage for each one of these?
From what I see
return false; can discontinue a function whereas
exit(); will prevent any further code running at all.
Is this correct?
exit() are precisely identical; they halt the entire PHP program and return to the OS. They’re two different names for the same function.
return, on the other hand, ends a function call and returns to the caller. At the end of a program,
return sets the status value that is returned to the OS; the program is going to exit no matter what.
According to docs PHP: exit Manual
die() is an alias to
exit() so they do the same function and that is to END the script.
return statement ends a function and not the entire script, and returns the value that you choose.