3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Foo; class Loader { public function __construct() { spl_autoload_register([$this, 'load']); } public function load() {} } spl_autoload_register(['Foo\Loader', 'load']); new Loader(); var_dump(spl_autoload_functions());
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught TypeError: spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, non-static method Foo\Loader::load() cannot be called statically in /in/e0kWP:9 Stack trace: #0 /in/e0kWP(9): spl_autoload_register(Array) #1 {main} thrown in /in/e0kWP on line 9
Process exited with code 255.
Output for 8.0.0 - 8.0.30
Fatal error: Uncaught TypeError: spl_autoload_register(): Argument #1 ($callback) must be a valid callback, non-static method Foo\Loader::load() cannot be called statically in /in/e0kWP:9 Stack trace: #0 /in/e0kWP(9): spl_autoload_register(Array) #1 {main} thrown in /in/e0kWP on line 9
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught LogicException: Passed array specifies a non static method but no object (non-static method Foo\Loader::load() should not be called statically) in /in/e0kWP:9 Stack trace: #0 /in/e0kWP(9): spl_autoload_register(Array) #1 {main} thrown in /in/e0kWP on line 9
Process exited with code 255.
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Fatal error: Uncaught exception 'LogicException' with message 'Passed array specifies a non static method but no object (non-static method Foo\Loader::load() should not be called statically)' in /in/e0kWP:9 Stack trace: #0 /in/e0kWP(9): spl_autoload_register(Array) #1 {main} thrown in /in/e0kWP on line 9
Process exited with code 255.

preferences:
156.18 ms | 402 KiB | 182 Q