Sorry for the dramatic sounding title, just wanted to know if there is a way to prevent all types of PHP commands from executing EXCEPT one.
For example, now when I kill a script using die() my pages look half broken because the bottom part of the page's html failed to load since it was being brought in using the include() function.
So is there a way to tell PHP "don't allow any more commands to be executed except the include function" ?
You can use return
to "terminate" an included file, without killing the whole script:
test1.php
<?php
include 'test2.php';
echo 'foo';
test2.php
<?php
echo 'bar';
return;
echo 'baz';
Outputs:
barfoo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With