What potential security risks are associated with using md5 encryption in PHP and what alternatives are recommended?

Using md5 encryption in PHP is not recommended for security purposes as it is considered to be weak and vulnerable to various attacks such as collision attacks. It is recommended to use stronger encryption algorithms such as SHA-256 or bcrypt for better security.

// Using SHA-256 encryption in PHP
$password = "password123";
$hashed_password = hash('sha256', $password);
echo $hashed_password;