3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php namespace Foo; class Loader { public function __construct() { spl_autoload_register([self, 'load']); } public static function load() {} } spl_autoload_register(['Foo\Loader', 'load']); new Loader(); var_dump(spl_autoload_functions());
based on A4UlM
Output for 7.2.0
Warning: Use of undefined constant self - assumed 'self' (this will throw an Error in a future version of PHP) in /in/9rd3M on line 5 array(2) { [0]=> array(2) { [0]=> string(10) "Foo\Loader" [1]=> string(4) "load" } [1]=> array(2) { [0]=> string(10) "Foo\Loader" [1]=> string(4) "load" } }
Output for 5.4.9 - 7.1.10
Notice: Use of undefined constant self - assumed 'self' in /in/9rd3M on line 5 array(2) { [0]=> array(2) { [0]=> string(10) "Foo\Loader" [1]=> string(4) "load" } [1]=> array(2) { [0]=> string(10) "Foo\Loader" [1]=> string(4) "load" } }
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[', expecting ')' in /in/9rd3M on line 5
Process exited with code 255.