What are some secure hashing methods recommended for password storage in PHP?

When storing passwords in PHP, it is crucial to hash them securely to protect user data in case of a breach. Some recommended hashing methods for password storage in PHP include bcrypt, Argon2, and PBKDF2. These algorithms are designed to be slow and computationally intensive, making it harder for attackers to crack hashed passwords.

// Using bcrypt for password hashing
$options = [
    'cost' => 12, // Adjust the cost factor based on your server's performance
];

$hashed_password = password_hash($password, PASSWORD_BCRYPT, $options);

// Verifying a password
if (password_verify($password, $hashed_password)) {
    // Password is correct
} else {
    // Password is incorrect
}