What are the potential pitfalls of using MD5 or SHA1 for encryption in PHP?

Using MD5 or SHA1 for encryption in PHP is not recommended due to their vulnerabilities to collision attacks. It is recommended to use stronger hashing algorithms such as SHA256 or SHA512 for better security. To implement this fix, simply replace the MD5 or SHA1 function calls with the desired hashing algorithm function.

// Using SHA256 for hashing
$password = "password123";
$hashed_password = hash('sha256', $password);
echo $hashed_password;