$password = "my_password"; $hash = password_hash($password, PASSWORD_BCRYPT); // $2y$10$vN1BBXwK.IWTrkRcRG2tLu67FPkpF2lLrf0By5rdzwa3NdzEgiBQi $password = "my_password"; $hash_from_db = '$2y$10$vN1BBXwK.IWTrkRcRG2tLu67FPkpF2lLrf0By5rdzwa3NdzEgiBQi' if (password_verify($password, $hash_from_db)) { echo 'Password is valid!'; } else { echo 'Invalid password.'; }