What are the limitations of using md5 for encryption in PHP applications, and what alternative encryption methods should be considered?

Using md5 for encryption in PHP applications is not recommended due to its vulnerabilities to collision attacks and its lack of security. Instead, more secure encryption methods such as bcrypt or SHA-256 should be considered for hashing sensitive data.

// Example of using bcrypt for hashing passwords
$password = "secret_password";
$hashed_password = password_hash($password, PASSWORD_BCRYPT);