spl_autoload_004.phpt 681 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --TEST--
  2. SPL: spl_autoload() with static methods
  3. --INI--
  4. include_path=.
  5. --FILE--
  6. <?php
  7. class MyAutoLoader {
  8. static function autoLoad($className) {
  9. echo __METHOD__ . "($className)\n";
  10. }
  11. }
  12. spl_autoload_register(array('MyAutoLoader', 'autoLoad'));
  13. // and
  14. $myAutoLoader = new MyAutoLoader();
  15. spl_autoload_register(array($myAutoLoader, 'autoLoad'));
  16. var_dump(spl_autoload_functions());
  17. // check
  18. var_dump(class_exists("TestClass", true));
  19. ?>
  20. ===DONE===
  21. <?php exit(0); ?>
  22. --EXPECTF--
  23. array(1) {
  24. [0]=>
  25. array(2) {
  26. [0]=>
  27. string(12) "MyAutoLoader"
  28. [1]=>
  29. string(8) "autoLoad"
  30. }
  31. }
  32. MyAutoLoader::autoLoad(TestClass)
  33. bool(false)
  34. ===DONE===