Are there any best practices for handling collisions in MD5 hashes in PHP?

When dealing with collisions in MD5 hashes in PHP, one common best practice is to use a secure hashing algorithm such as SHA-256 instead of MD5. This can help mitigate the risk of collisions and improve the overall security of your application. Additionally, you can implement salting and key stretching techniques to further enhance the security of your hashes.

// Example code snippet using SHA-256 instead of MD5 for hashing
$password = "password123";
$salt = "somesalt";

$hashed_password = hash('sha256', $password . $salt);

echo $hashed_password;