← All built-ins / password_verify()

password_verify()

password_verify(string $haystack, string $needle): bool

Parameters

NameTypeDescription
$passwordstringplain password to check
$hashstringhash from password_hash()

Return value

true when the password matches the hash (timing-safe).

Example

$h = password_hash("secret");
var_dump(password_verify("secret", $h));
var_dump(password_verify("Secret", $h));
bool(true)
bool(false)

See also

password_hash()