<?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());
Fatal error: Uncaught Error: Undefined constant "Foo\self" in /in/9rd3M:5
Stack trace:
#0 /in/9rd3M(10): Foo\Loader->__construct()
#1 {main}
thrown in /in/9rd3M on line 5
Process exited with code 255.
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"
}
}