I have a file called functions.php
.
This file consists includes to all the other function files, for example:
include_once("user_functions.php");
include_once("foo_functions.php");
I would like to catch errors where when I screw a code in one of those files, It wouldn't give the error to the entire system.
For example, if there is a parser error in foo_functions.php
it will just not include it in functions.php
.
Is that possible?
As of PHP 7, most eval/include errors, such as ParseError can be catched:
try {
include_once(__DIR__ . '/test.php');
} catch (\Throwable $e) {
var_dump($e);
}
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