What are the potential risks of using outdated functions like md5() in PHP scripts, and how can developers mitigate these risks?

Using outdated functions like md5() in PHP scripts can pose security risks as they are vulnerable to various attacks such as collision attacks and pre-image attacks. Developers can mitigate these risks by using more secure hashing algorithms like SHA-256 or bcrypt.

// Using SHA-256 hashing algorithm instead of md5
$hashed_password = hash('sha256', $password);