Zend
200-710 · Question #138
What is the output of the following code? ``php try { class MyException extends Exception {}; try { throw new MyException; } catch (Exception $e) { echo "1: "; throw $e; } catch (MyException $e) { ech
The correct answer is E. 1:MyException. See the full explanation below for the reasoning.
Question
What is the output of the following code?
try {
class MyException extends Exception {};
try {
throw new MyException;
}
catch (Exception $e) {
echo "1: ";
throw $e;
}
catch (MyException $e) {
echo "2: ";
throw $e;
}
}
catch (Exception $e) {
echo get_class($e);
}
Options
- AA parser error, try cannot be followed by multiple catch
- B1:
- C2:
- D1:Exception
- E1:MyException
- F2:MyException
- GMyException
How the community answered
(48 responses)- B2% (1)
- C4% (2)
- D15% (7)
- E71% (34)
- F8% (4)
Community Discussion
No community discussion yet for this question.