fork download
  1. <?php
  2.  
  3. class AcceptedException extends \Exception
  4. {
  5. }
  6.  
  7. try {
  8. $obj = (object) ['foo' => 'bar'];
  9. if (!$obj->foo) {
  10. throw new \AcceptedException;
  11. }
  12. throw new \RuntimeException('Oops');
  13. } catch(\AcceptedException $e) {
  14. var_dump('I was accepted');
  15. } catch(\Exception $e) {
  16. throw $e; //don't handle the exception
  17. }
  18. var_dump($obj->foo);
Runtime error #stdin #stdout #stderr 0s 52488KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Fatal error:  Uncaught exception 'RuntimeException' with message 'Oops' in /home/FC05tR/prog.php:12
Stack trace:
#0 {main}
  thrown in /home/FC05tR/prog.php on line 12