What are the potential pitfalls of using the md5 function in PHP for password hashing?

Using the md5 function in PHP for password hashing is not recommended because it is considered to be a weak hashing algorithm. It is susceptible to rainbow table attacks and brute force attacks, making it easier for attackers to crack hashed passwords. It is better to use stronger hashing algorithms like bcrypt or Argon2 for secure password storage.

// Implementing password hashing using bcrypt
$password = "password123";
$hashed_password = password_hash($password, PASSWORD_BCRYPT);