How can MD5 be effectively used for password hashing in PHP applications?

Using MD5 for password hashing in PHP applications is not recommended due to its vulnerabilities to brute force attacks and collisions. Instead, it is recommended to use stronger hashing algorithms like bcrypt or Argon2. These algorithms are specifically designed for securely hashing passwords and are much more resistant to attacks.

// Using bcrypt for password hashing in PHP
$password = "mySecurePassword";
$hashedPassword = password_hash($password, PASSWORD_BCRYPT);