How can the usage of the md5 function for password hashing in PHP be improved for better security?

Using the md5 function for password hashing in PHP is not recommended for security reasons as it is considered weak and vulnerable to attacks. To improve security, it is recommended to use stronger hashing algorithms like bcrypt or Argon2. These algorithms are specifically designed for password hashing and offer better security against brute force and rainbow table attacks.

// Using bcrypt for password hashing
$hashed_password = password_hash($password, PASSWORD_BCRYPT);