3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { private $ye = "true"; private $nah; public function __construct() { throw new B($this); } } class B { private $that; public function __construct($that) { $this->that = $that; } } try { $a = new A(); } catch (B $b) { var_dump($b, $a); }
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Cannot throw objects that do not implement Throwable in /in/cYOLg:9 Stack trace: #0 /in/cYOLg(23): A->__construct() #1 {main} thrown in /in/cYOLg on line 9
Process exited with code 255.
Output for 5.3.18 - 5.6.28
Fatal error: Exceptions must be valid objects derived from the Exception base class in /in/cYOLg on line 9
Process exited with code 255.