fork download
  1. <?php
  2.  
  3. function autoload_a($file) {
  4. $path = __DIR__ . '/a/' . $file;
  5. if (is_file($path)) {
  6. require $path;
  7. }
  8. }
  9. class Test {
  10. public function autoload_b($file) {
  11. $path = __DIR__ . '/b/' . $file;
  12. if (is_file($path)) {
  13. require $path;
  14. }
  15. }
  16. }
  17. $args = array(
  18. 'autoload_a',
  19. array(new Test, 'autoload_b'),
  20. function($file) {
  21. $path = __DIR__ . '/c/' . $file;
  22. if (is_file($path)) {
  23. require $path;
  24. }
  25. }
  26. );
  27. array_map('spl_autoload_register', $args);
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
array(3) {
  [0]=>
  string(10) "autoload_a"
  [1]=>
  array(2) {
    [0]=>
    object(Test)#1 (0) {
    }
    [1]=>
    string(10) "autoload_b"
  }
  [2]=>
  object(Closure)#2 (1) {
    ["parameter"]=>
    array(1) {
      ["$file"]=>
      string(10) "<required>"
    }
  }
}