title: Handle exception and continue executing
body: <p>[EDIT - Disclaimer: This is a really bad idea, see the accepted answer for an actual solution.]</p>
  
  <p>I define my own exception handler using set_exception_handler() function. After the handler execution, I need the script to continue. Is there any way to do it?</p>
  
  <p>Disclaimer: I know try-catch blocks but I need to process Exceptions dynamicaly. Every calling of Clazz::foo() specifies its own exceptions which should be caught by my handler. That's the reason I can't use it.</p>
  
  <p>Example:</p>
  
  <pre><code>class Clazz {
  
      private static $exceptions;
  
      public static function foo(array $exceptions) {
          set_exception_handler(array(__CLASS__, "exception_handler"));
          self::$exceptions = $exceptions;
          throw new RandomException;
          echo "I need this to be printed!";
      }
  
      public static function exception_handler($exception) {
          // process the exception in my way...
          // if $exception in self::$exceptions than 1, else 2, fi
          restore_exception_handler();
          // continue in some way, like it has never happenned
      }
  
  }
  </code></pre>