spl_autoload_functions
Description
The spl_autoload_functions of SPL for PHP returns all registered __autoload() functions.
Syntax
spl_autoload_functions(): array
Return
Returns an array of all registered __autoload functions. If no function is registered, or the autoload queue is not activated, then the return value will be an empty array.
Examples
1 · void
<? $return = spl_autoload_functions(); print_r($return); ?>
Array ( )
2 · spl_autoload_register · default
<? spl_autoload_register(); $return = spl_autoload_functions(); print_r($return); ?>
Array ( [0] => spl_autoload )
3 · spl_autoload_register · callback
<? function callback($class) { } $callback = "callback"; spl_autoload_register($callback); $return = spl_autoload_functions(); print_r($return); ?>
Array ( [0] => callback )
4 · spl_autoload_register · callback · multiple
<? function callback1($class) { } function callback2($class) { } function callback3($class) { } $callback1 = "callback1"; $callback2 = "callback2"; $callback3 = "callback3"; spl_autoload_register($callback1); spl_autoload_register($callback2); spl_autoload_register($callback3); $return = spl_autoload_functions(); print_r($return); ?>
Array ( [0] => callback1 [1] => callback2 [2] => callback3 )
5 · namespace · void
<? namespace mynamespace; class myclass { public function __construct() { $return = spl_autoload_functions(); print_r($return); } } new myclass(); ?>
Array ( )
6 · namespace · spl_autoload_register · default
<? namespace mynamespace; class myclass { public function __construct() { spl_autoload_register(); $return = spl_autoload_functions(); print_r($return); } } new myclass(); ?>
Array ( [0] => spl_autoload )
7 · namespace · spl_autoload_register · callback
<? namespace mynamespace; class myclass { public function __construct() { $callback = __CLASS__ . "::callback"; spl_autoload_register($callback); $return = spl_autoload_functions(); print_r($return); } public function callback($class) { } } new myclass(); ?>
Array ( [0] => Array ( [0] => mynamespace\myclass Object ( ) [1] => callback ) )
8 · namespace · spl_autoload_register · callback · multiple
<? namespace mynamespace; class myclass { public function __construct() { $callback1 = __CLASS__ . "::callback1"; $callback2 = __CLASS__ . "::callback2"; $callback3 = __CLASS__ . "::callback3"; spl_autoload_register($callback1); spl_autoload_register($callback2); spl_autoload_register($callback3); $return = spl_autoload_functions(); print_r($return); } public function callback1($class) { } public function callback2($class) { } public function callback3($class) { } } new myclass(); ?>
Array ( [0] => Array ( [0] => mynamespace\myclass Object ( ) [1] => callback1 ) [1] => Array ( [0] => mynamespace\myclass Object ( ) [1] => callback2 ) [2] => Array ( [0] => mynamespace\myclass Object ( ) [1] => callback3 ) )