200-710 Exam QuestionsBrowse all questions from this exam

200-710 Exam - Question 29


What exception type will catch the error raised by the expression 2 / 0?

Show Answer
Correct Answer: C

The expression 2 / 0 results in a division by zero, which raises a DivisionByZeroError in PHP. Therefore, the correct exception type that will catch this error is DivisionByZeroError.

Discussion

1 comment
Sign in to comment
mikedenameOption: C
Nov 22, 2021

Be careful because arithmetic operator "/" does not throw an exception in PHP 7. https://www.php.net/manual/en/class.divisionbyzeroerror.php#125565