How can passwords be securely stored in a PHP database using MD5 encryption?

Passwords can be securely stored in a PHP database using MD5 encryption by hashing the password before storing it in the database. This ensures that even if the database is compromised, the passwords cannot be easily decrypted.

$password = "mySecurePassword";
$hashed_password = md5($password);

// Store $hashed_password in the database