phpreturnexitdie

PHP: What is the difference between exit(), die() and return; within "self" and included files?


I'm still on a PHP learning curb. When terminating a script, what is the difference between exit(), die(); and return;?:

  1. within the same file (Single script file)
  2. Within the child of an include
  3. Within the parent of an include

Solution

  • Return returns a value. This can be anything and is meant for functions.

    What are the differences in die() and exit() in PHP?

    http://php.net/manual/en/function.return.php