3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function __autoload($n){ static $classes = [ 'Foo' => 'utils/foo.php', 'Bar' => 'utils/bar.php', 'Baz' => 'utils/baz.php', 'Widget' => 'vendor/widget.php', 'Gadget' => 'vendor/gadget.php', 'Doodad' => 'vendor/doodad.php', ]; if(array_key_exists($n, $classes)){ require_once($classes[$n]); } } new Foo;
based on KRV8G
Output for 7.2.0, 7.3.0alpha1 - 7.3.0beta1
Deprecated: __autoload() is deprecated, use spl_autoload_register() instead in /in/ojjFi on line 3 Warning: require_once(utils/foo.php): failed to open stream: No such file or directory in /in/ojjFi on line 13 Fatal error: require_once(): Failed opening required 'utils/foo.php' (include_path='.:') in /in/ojjFi on line 13
Process exited with code 255.
Output for 7.2.6
Deprecated: __autoload() is deprecated, use spl_autoload_register() instead in /in/ojjFi on line 3 Warning: require_once(): open_basedir restriction in effect. File(utils/foo.php) is not within the allowed path(s): (/tmp:/in) in /in/ojjFi on line 13 Warning: require_once(utils/foo.php): failed to open stream: Operation not permitted in /in/ojjFi on line 13 Fatal error: require_once(): Failed opening required 'utils/foo.php' (include_path='.:') in /in/ojjFi on line 13
Process exited with code 255.
Output for 7.1.20
Warning: require_once(): open_basedir restriction in effect. File(utils/foo.php) is not within the allowed path(s): (/tmp:/in) in /in/ojjFi on line 13 Warning: require_once(utils/foo.php): failed to open stream: Operation not permitted in /in/ojjFi on line 13 Fatal error: require_once(): Failed opening required 'utils/foo.php' (include_path='.:') in /in/ojjFi on line 13
Process exited with code 255.
Output for 5.6.0 - 7.1.10
Warning: require_once(utils/foo.php): failed to open stream: No such file or directory in /in/ojjFi on line 13 Fatal error: require_once(): Failed opening required 'utils/foo.php' (include_path='.:') in /in/ojjFi on line 13
Process exited with code 255.