password_get_info()

password_get_info() — Returns information about the given hash.

Built-in function of PHP 8.5. The manual lists it as available in PHP 5 >= 5.5.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

When passed in a valid hash created by an algorithm supported by password_hash(), this function will return an array of information about that hash.

Signature

password_get_info(string $hash): array

Parameters

ParameterTypeWhat it takes
$hashstringA hash created by password_hash().

Return value

Returns an associative array with three elements: algo, which will match a password algorithm constant algoName, which has the human readable name of the algorithm options, which includes the options provided when calling password_hash() algo, which will match a password algorithm constant algoName, which has the human readable name of the algorithm options, which includes the options provided when calling password_hash()

Example

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

All PHP 8.5 built-in functions

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