Can the md5() function be used for encryption purposes in PHP?

The md5() function in PHP should not be used for encryption purposes as it is not secure for that use case. It is a hashing function, not an encryption function, and it is considered weak and vulnerable to attacks. For encryption purposes, it is recommended to use more secure encryption methods such as AES.

// Example of using md5() for hashing, not encryption
$password = 'secret';
$hashed_password = md5($password);
echo $hashed_password;