2 quizzes found.

What is the output of the following code?


class MyException extends Exception {}
class AnotherException extends MyException {}

class Foo {
  public function something() {
    throw new AnotherException();
  public function somethingElse() {
    throw new MyException();

$a = new Foo();

try {
  try {
  } catch(AnotherException $e) {
  } catch(MyException $e) {
    print "Caught Exception";
} catch(Exception $e) {
  print "Didn't catch the Exception!";

  1. "Caught Exception" followed by "Didn't catch the Exception!"
  2. A fatal error for an uncaught exception
  3. "Didn't catch the Exception!"
  4. "Didn't catch the Exception!" followed by a fatal error
  5. "Caught Exception"

Choose 1 answers

In which of the following situations will you use the set_exception_handler() function?

  1. When you want to restore a previously defined exception handler function
  2. When the try/catch block is unable to catch an exception
  3. When you want to set a user-defined function to handle errors
  4. When you want to generate a user-level error/warning/notice message

Choose 1 answers