Exam 200-710 All QuestionsBrowse all questions from this exam
Question 29

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

    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
mikedenameOption: C

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