HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

spl_autoload_call

Description

The spl_autoload_call of SPL for PHP tries all registered __autoload() functions to load the requested class.

Syntax

spl_autoload_call(
    string $class
): void

Parameters

class

The class name being searched.

Return

No value is returned.

Examples

1 · class

<?

class myclass
{
    public static function callback($class)
    {
    }
}

$callback = "myclass::callback";

spl_autoload_register($callback);

$class = "myclass";

spl_autoload_call($class);

2 · namespace

<?

namespace mynamespace;

class myclass
{
    public function __construct()
    {
        $callback = __CLASS__ . "::callback";

        spl_autoload_register($callback);

        $class = __CLASS__;

        spl_autoload_call($class);
    }
    public function callback($class)
    {
    }
}

new myclass();