Zend
200-550 · Question #114
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…
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
(49 responses)- A4% (2)
- B2% (1)
- E76% (37)
- F12% (6)
- G6% (3)
Community Discussion
No community discussion yet for this question.