xref: /PHP-7.4/ext/spl/tests/spl_autoload_004.phpt (revision ded3d984)
1--TEST--
2SPL: spl_autoload() with static methods
3--INI--
4include_path=.
5--FILE--
6<?php
7
8class MyAutoLoader {
9
10        static function autoLoad($className) {
11        	echo __METHOD__ . "($className)\n";
12        }
13}
14
15spl_autoload_register(array('MyAutoLoader', 'autoLoad'));
16
17// and
18
19$myAutoLoader = new MyAutoLoader();
20
21spl_autoload_register(array($myAutoLoader, 'autoLoad'));
22
23var_dump(spl_autoload_functions());
24
25// check
26var_dump(class_exists("TestClass", true));
27
28?>
29===DONE===
30<?php exit(0); ?>
31--EXPECT--
32array(1) {
33  [0]=>
34  array(2) {
35    [0]=>
36    string(12) "MyAutoLoader"
37    [1]=>
38    string(8) "autoLoad"
39  }
40}
41MyAutoLoader::autoLoad(TestClass)
42bool(false)
43===DONE===
44