spl_autoload_register

The timeline below displays how wordpress function spl_autoload_register has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 4.9

/**
 * Registers a function to be autoloaded.
 *
 * @since 4.6.0
 *
 * @param callable $autoload_function The function to register.
 * @param bool     $throw             Optional. Whether the function should throw an exception
 *                                    if the function isn't callable. Default true.
 * @param bool     $prepend           Whether the function should be prepended to the stack.
 *                                    Default false.
 */
function spl_autoload_register($autoload_function, $throw = true, $prepend = false)
{
    if ($throw && !is_callable($autoload_function)) {
        // String not translated to match PHP core.
        throw new Exception('Function not callable');
    }
    global $_wp_spl_autoloaders;
    // Don't allow multiple registration.
    if (in_array($autoload_function, $_wp_spl_autoloaders)) {
        return;
    }
    if ($prepend) {
        array_unshift($_wp_spl_autoloaders, $autoload_function);
    } else {
        $_wp_spl_autoloaders[] = $autoload_function;
    }
}