What is the difference between using exit() and return; in an included PHP script?

Using exit() in a PHP script will immediately terminate the script and prevent any further code from being executed, while using return; will only exit the current function or included script and allow the rest of the code to continue executing. If you want to stop the entire script from running when including a PHP script, it is better to use exit(); to ensure that no further code is executed.

// Using exit() to terminate the entire script
include 'included_script.php';
exit();

// Using return; to only exit the current function or included script
include 'included_script.php';
return;