Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 1
    This doesn't seem to catch Parse Errors. Commented Sep 18, 2023 at 12:16
  • This solution works for me and catches ParseError as well. I am using PHP 8.2. Commented Nov 25, 2024 at 13:19
  • I can confirm this catches "uncaught error" which was a syntax error in my evaluated code. Using 8.1. Hmm, can you do a try within a try within a try?... I'll go away and find out - probably can't! :)) Commented Mar 10 at 22:46