3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php spl_autoload_register(function ($class) { if ('foo' === $class) { class foo implements foointerface {} } elseif ('foointerface' === $class) { throw new \Exception('boo'); } }); try { class_exists('foo'); } catch (\Exception $e) { var_dump($e->getMessage()); } $a = new foo(); var_dump($a); var_dump($a instanceof foointerface);
based on nYXIQ
Output for 5.3.1 - 5.6.38, 7.0.0 - 7.3.0rc3
string(3) "boo" object(foo)#3 (0) { } bool(false)
Output for hhvm-3.22.0
string(3) "boo" Fatal error: Uncaught exception 'Exception' with message 'boo' in /in/1pHqv:-1 Stack trace: #0 /in/1pHqv(-1): Closure$() #1 /in/1pHqv(-1): Closure$() #2 {main}
Process exited with code 255.
Output for hhvm-3.10.1 - 3.21.3
string(3) "boo" Fatal error: Uncaught exception 'Exception' with message 'boo' in /in/1pHqv:7 Stack trace: #0 /in/1pHqv(5): Closure$() #1 /in/1pHqv(17): Closure$() #2 {main}
Process exited with code 255.
Output for 5.3.0

Process exited with code 139.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/1pHqv on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/1pHqv on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/1pHqv on line 3
Process exited with code 255.