3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function x($class) { print "xxx\n"; // gets printed throw new Exception("Class '{$class}' not found"); } spl_autoload_register('x'); try { $a = A::z(); // FATAL ERROR: class 'A' not found // NOTE: // $a = A::$z; - will be correctly caught } catch (Exception $ex) { print "Exception catched \o/ {$ex}\n"; // never gets executed }
Output for 7.0.0 - 7.1.0
xxx Exception catched \o/ Exception: Class 'A' not found in /in/JD1ro:5 Stack trace: #0 [internal function]: x('A') #1 /in/JD1ro(10): spl_autoload_call('A') #2 {main}
Output for hhvm-3.10.0 - 3.12.0
xxx Exception catched \o/ exception 'Exception' with message 'Class 'A' not found' in /in/JD1ro:5 Stack trace: #0 /in/JD1ro(10): x() #1 {main}
Output for 5.3.18 - 5.3.29, 5.4.1 - 5.6.28
xxx Exception catched \o/ exception 'Exception' with message 'Class 'A' not found' in /in/JD1ro:5 Stack trace: #0 [internal function]: x('A') #1 /in/JD1ro(10): spl_autoload_call('A') #2 {main}
Output for 5.3.3 - 5.3.17, 5.4.0
xxx Fatal error: Class 'A' not found in /in/JD1ro on line 10
Process exited with code 255.
Output for 5.3.0 - 5.3.2
xxx Fatal error: Class 'A' not found in /in/JD1ro on line 0
Process exited with code 255.
Output for 5.1.0 - 5.2.17
xxx Fatal error: Class 'A' not found in /in/JD1ro on line 15
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function spl_autoload_register() in /in/JD1ro on line 8
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_NEW in /in/JD1ro on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_NEW in /in/JD1ro on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/JD1ro on line 5
Process exited with code 255.