200-710 Exam QuestionsBrowse all questions from this exam

200-710 Exam - Question 35


True or false: you can catch fatal errors (e.g., parse errors, out of memory errors, compilation errors) in PHP 7 using try/catch.

Show Answer
Correct Answer: AB

Starting from PHP 7, you can catch fatal errors such as parse errors, out of memory errors, and compilation errors using try/catch blocks. This is done by catching instances of the Error class, which represents fatal errors. This change was introduced to provide better error handling mechanisms and more control over error management in PHP.

Discussion

1 comment
Sign in to comment
[Removed]Option: A
Jun 27, 2020

in PHP 7.x and 8.x, now it's possible to catch Fatar errors.. So the answer should be "True". Example : try { someNoneExistentFunction(); } catch (Error $e) { echo "There is an Error caught here: " . $e->getMessage(); } Output for 7.x There is an Error caught here: Call to undefined function someNoneExistentFunction() Output for 5.x : Fatal error: Call to undefined function someNoneExistentFunction()