3v4l.org

run code in 300+ PHP versions simultaneously
<?php spl_autoload_register(function ($c) { if ('ChildClass' === $c) { class ChildClass extends ParentClass {} } if ('ParentClass' === $c) { throw new \Exception('ParentClass not found.'); } }); try { new ChildClass(); } catch (\Exception $e) { echo $e->getMessage(); }

preferences:
64.64 ms | 404 KiB | 5 Q