What are the common pitfalls when using MD5 for password storage in PHP?

One common pitfall when using MD5 for password storage in PHP is that it is not secure enough for modern standards, as it is vulnerable to various attacks such as collision attacks and rainbow table attacks. To improve security, it is recommended to use stronger hashing algorithms like bcrypt or Argon2 for password hashing.

// Using bcrypt for password hashing
$password = "secret_password";
$hashed_password = password_hash($password, PASSWORD_BCRYPT);
if (password_verify($password, $hashed_password)) {
    // Password is correct
    echo "Password is correct";
} else {
    // Password is incorrect
    echo "Password is incorrect";
}