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

Omar picture Omar · Dec 20, 2012 · Viewed 10.4k times · Source

Am am 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

Answer

Jordi Kroon picture Jordi Kroon · Dec 20, 2012

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