3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php trait foo { } class bar { use foo; } print_r(class_uses(new bar)); print_r(class_uses('bar')); function __autoload($class_name) { require_once $class_name . '.php'; } // use __autoload to load the 'not_loaded' class print_r(class_uses('not_loaded', true)); ?>
Output for 5.4.0 - 5.6.28, 7.0.0 - 7.1.0
Array ( [foo] => foo ) Array ( [foo] => foo ) Warning: require_once(not_loaded.php): failed to open stream: No such file or directory in /in/dD0WN on line 13 Fatal error: require_once(): Failed opening required 'not_loaded.php' (include_path='.:') in /in/dD0WN on line 13
Process exited with code 255.
Output for hhvm-3.12.0
Array ( [foo] => foo ) Array ( [foo] => foo ) Fatal error: Uncaught Error: File not found: not_loaded.php in /in/dD0WN:13 Stack trace: #0 /in/dD0WN(17): __autoload() #1 {main}
Process exited with code 255.
Output for hhvm-3.10.0
Array ( [foo] => foo ) Array ( [foo] => foo ) Fatal error: File not found: not_loaded.php in /in/dD0WN on line 13
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/dD0WN 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_STRING in /in/dD0WN on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/dD0WN on line 3
Process exited with code 255.