What exception type will catch the error raised by the expression 2 / 0?
What exception type will catch the error raised by the expression 2 / 0?
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.
Be careful because arithmetic operator "/" does not throw an exception in PHP 7. https://www.php.net/manual/en/class.divisionbyzeroerror.php#125565