Is using md5 for password encryption considered secure in PHP?

Using md5 for password encryption is not considered secure in PHP due to its vulnerability to brute force attacks and the availability of faster and more secure hashing algorithms like bcrypt or Argon2. To improve security, it is recommended to use a stronger hashing algorithm like bcrypt or Argon2 for password encryption in PHP.

// Using bcrypt for password encryption
$password = 'password123';
$hashedPassword = password_hash($password, PASSWORD_BCRYPT);

// Verifying the password
if (password_verify($password, $hashedPassword)) {
    echo 'Password is valid!';
} else {
    echo 'Invalid password.';
}