What are the potential security risks associated with using MD5 encryption in PHP?

Using MD5 encryption in PHP poses security risks because MD5 is considered cryptographically broken and vulnerable to collision attacks. It is recommended to use stronger hashing algorithms like SHA-256 or SHA-512 for better security.

// Example of using SHA-256 for hashing instead of MD5
$password = "password123";
$hashed_password = hash('sha256', $password);
echo $hashed_password;