register_shutdown_function

FunctionReturn type changed in PHP 8.2

Register a function for execution on shutdown.

PHP 5
PHP 7
PHP 8.0
Improved
PHP 8.1-8.2
PHP 8.3
PHP 8.4
PHP 8.5

register_shutdown_function Function synopsis

register_shutdown_function(callable $callback, mixed ...$args): void

Parameters

$callback

Typecallable

The shutdown callback to register.

$args

Variadic, OptionalTypemixed

It is possible to pass parameters to the shutdown function by passing additional parameters.

Return value

The register_shutdown_function function is a void function; it does not return any values.

Changes to the register_shutdown_function Function

PHP 8.2

  • Return type changed: ?bool to void
- register_shutdown_function(callable $callback, mixed ...$args): ?bool
+ register_shutdown_function(callable $callback, mixed ...$args): void

PHP 8.0

  • Return type added: ?bool
  • Parameter name of parameter #1 changed: $function_name to $callback
  • Parameter type added for parameter #1 ($callback): callable
  • Parameter name of parameter #2 changed: $parameters to $args
  • Parameter type added for parameter #2 ($args): mixed
- register_shutdown_function($function_name, ...$parameters)
+ register_shutdown_function(callable $callback, mixed ...$args): ?bool

PHP 5.6

  • Optional parameter added - #2: $parameters
- register_shutdown_function($function_name)
+ register_shutdown_function($function_name, ...$parameters)

register_shutdown_function Function Availability

PHP VersionAvailability
PHP 8.5Upcoming Release Yes
PHP 8.4Supported (Latest) Yes
PHP 8.3Supported Yes
PHP 8.2Security-Fixes Only Yes
PHP 8.1Security-Fixes Only Yes
PHP 8.0Unsupported Yes
PHP 7.4Unsupported Yes
PHP 7.3Unsupported Yes
PHP 7.2Unsupported Yes
PHP 7.1Unsupported Yes
PHP 7.0Unsupported Yes
PHP 5.6Unsupported Yes
PHP 5.5Unsupported Yes
PHP 5.4Unsupported Yes
PHP 5.3Unsupported Yes