What are the potential security risks associated with using the md5 function to hash passwords in PHP?

Using the md5 function to hash passwords in PHP is not recommended for security reasons as it is considered weak and vulnerable to attacks such as collision and rainbow table attacks. It is better to use stronger hashing algorithms like bcrypt or Argon2 for securely storing passwords.

// Using bcrypt to hash passwords securely
$hashed_password = password_hash($password, PASSWORD_BCRYPT);