PHP robust include to handle errors?
exception, include, php
Solution
You can just
@include "fileWithBadSyntax.php";
Which, from my quick tests, works for both parse errors or errors thrown with trigger_error().
EDIT: This is completely wrong. See sneak's answer, which is correct, if somewhat unhelpful.
Problem
I have a PHP app "index.php" that, for various reasons, needs to run other PHP scripts by using `include_once` on that other script. That other script isn't very stable, so is there some way to do a safe `include_once` that won't halt the caller? i.e.: ``` <?php safely_include_once('badfile.php'); // MAY throw syntax error, parse error, other badness echo "I can continue execution after error"; ?> ``` (I know what a bad idea this can be, etc., rest assured this isn't production-environment stuff.)