- var_dump: documentation ( source)
- password_hash: documentation ( source)
- password_needs_rehash: documentation ( source)
- password_verify: documentation ( source)
<?php
function password_verify_with_rehash($password, $hash) {
if (!password_verify($password, $hash)) {
return false;
}
if (password_needs_rehash($hash, PASSWORD_DEFAULT)) {
$hash = password_hash($password, PASSWORD_DEFAULT);
return $hash;
}
}
var_dump(
password_verify_with_rehash()
);