How does the md5() function in PHP compare to other encryption methods for text and password protection?

The md5() function in PHP is not recommended for text and password protection due to its vulnerability to brute force attacks and collision vulnerabilities. It is considered outdated and insecure for cryptographic purposes. It is recommended to use more secure encryption methods like bcrypt or Argon2 for password hashing.

// Example using bcrypt for password hashing
$password = "secret_password";
$hashed_password = password_hash($password, PASSWORD_BCRYPT);
// Verify password
if (password_verify($password, $hashed_password)) {
    echo "Password is correct";
} else {
    echo "Password is incorrect";
}