Are there any potential security risks associated with using the md5 function for string encryption in PHP?

Using the md5 function for string encryption in PHP is not recommended for security purposes as it is considered weak and vulnerable to various attacks such as collision attacks. It is better to use more secure hashing algorithms like SHA-256 or bcrypt for encryption.

// Using the password_hash function with bcrypt algorithm for secure encryption
$password = "secret_password";
$hashed_password = password_hash($password, PASSWORD_BCRYPT);