nerdexam
Zend

200-710 · Question #230

200-710 Question #230: Real Exam Question with Answer & Explanation

The correct answer is C. `catch (MyException | TheirException $e)`. See the full explanation below for the reasoning.

Question

Given the following PHP code:
<?php
class MyException extends Exception {
 //
}

try {
 throw new MyException('something went wrong');
} *** {
 echo $e->getMessage();
}
?>
Which code, if put on place of '***', will NOT prompt the code to output "something went wrong" when run?

Options

  • Acatch (Exception $e)
  • Bcatch (MyException $e)
  • Ccatch (MyException | TheirException $e)
  • Dcatch (Error $e)

Community Discussion

No community discussion yet for this question.

Full 200-710 Practice