332 of 410 menu

The spl_autoload_functions Function

The spl_autoload_functions function returns an array of all autoload functions registered with spl_autoload_register. If no autoloaders are registered, the function will return an empty array.

Syntax

spl_autoload_functions();

Example

Let's check the list of registered autoloaders without registration:

<?php $res = spl_autoload_functions(); print_r($res); ?>

Code execution result:

[]

Example

Let's register an autoloader and check the result:

<?php function my_autoload($class) { include $class . '.php'; } spl_autoload_register('my_autoload'); $res = spl_autoload_functions(); print_r($res); ?>

Code execution result:

['my_autoload']

Example

Let's check several registered autoloaders:

<?php function autoload1($class) { // implementation 1 } function autoload2($class) { // implementation 2 } spl_autoload_register('autoload1'); spl_autoload_register('autoload2'); $res = spl_autoload_functions(); print_r($res); ?>

Code execution result:

['autoload1', 'autoload2']

See Also

byenru