die()

die() — Alias of exit().

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

die() is an alias of exit(): same parameters, same return value.

Signature

die(string|int $status = 0): never

Parameters

ParameterTypeWhat it takes
$statusstring|intIf status is an int, the exit code returned by PHP will be status. Note: Exit codes should be in the range 0 to 254, the exit code 255 is reserved by PHP and should not be used.

Return value

As this terminates the PHP script, no value is returned.

Example

A runnable snippet:

// exit program normally exit(); exit(0); // exit with an error code exit(1);

All PHP 8.5 built-in functions

Reference card built from the PHP manual page die() (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.