← All built-ins / password_verify()
password_verify()
password_verify(string $haystack, string $needle): bool
Parameters
| Name | Type | Description |
|---|---|---|
| $password | string | plain password to check |
| $hash | string | hash 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)