Easy Tutorial
❮ Func Xml Error String Func Array Shift ❯

PHP password_verify() Function

PHP Password Hashing Algorithm

The password_verify() function is used to verify that a password matches a hash.

PHP Version Requirements: PHP 5 >= 5.5.0, PHP 7

Syntax

bool password_verify ( string $password , string $hash )

Parameter Descriptions:

Return Value

Returns TRUE if the password matches the hash, otherwise returns FALSE.

Example

Usage of password_verify()

<?php
// To understand where the following characters come from, see the example of password_hash()
$hash = '$2y$07$BCryptRequires22Chrcte/VlQH0piJtjXl.0t1XkA8pw9dMXTpOq';

if (password_verify('rasmuslerdorf', $hash)) {
    echo 'Password is valid!';
} else {
    echo 'Invalid password.';
}
?>

Output:

Password is valid!

PHP Password Hashing Algorithm

❮ Func Xml Error String Func Array Shift ❯