I think you expect return be more like an exception than the return statement. Take the following code, for example:
return.php:
return true; ?>
exception.php:
<?php throw new exception(); ?>
When executing the following code:
<?php function testReturn() { echo 'Executing testReturn()...'; include_once('return.php'); echo 'testReturn() executed normally.'; } function testException() { echo 'Executing testException()...'; include_once('exception.php'); echo 'testException() executed normally.'; } testReturn(); echo "\n\n"; try { testException(); } catch (exception $e) {} ?>
... the result is the following result:
Executing testReturn () ... testReturn () runs fine.
Running testException () ...
If you use the exception method, be sure to put the function call in a try...catch if exceptions thrown everywhere are bad for business.
Jacob hume
source share