spl_autoload_unregister()

spl_autoload_unregister() — Unregister given function as __autoload() implementation.

Built-in function of PHP 8.5. The manual lists it as available in PHP 5 >= 5.1.0, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.

What it does

Removes a function from the autoload queue. If the queue is activated and empty after removing the given function then it will be deactivated.

Signature

spl_autoload_unregister(callable $callback): bool

Parameters

ParameterTypeWhat it takes
$callbackcallableThe autoload function being unregistered.

Return value

Returns true on success or false on failure.

Example

The PHP manual ships no example for spl_autoload_unregister(); the signature and the parameter table above are the contract.

Changelog

VersionChange
8.5.0Passing the spl_autoload_call() function as a callback argument to unregister all autoloaders has been deprecated. Instead iterate over the return value of spl_autoload_functions() and call spl_autoload_unregister() on each value.

All PHP 8.5 built-in functions

Reference card built from the PHP manual page spl_autoload_unregister() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.