What are the potential security risks associated with using MD5 for hashing passwords in PHP?

Using MD5 for hashing passwords in PHP is not recommended due to its vulnerability to collision attacks, where two different inputs can produce the same hash value. This can lead to security risks such as password cracking and unauthorized access to user accounts. To mitigate this risk, it is recommended to use stronger hashing algorithms like bcrypt or Argon2 for securely hashing passwords.

// Correct way to hash passwords using bcrypt
$hashed_password = password_hash($password, PASSWORD_BCRYPT);