What considerations should be made when using crypt() in PHP for password encryption?

When using crypt() in PHP for password encryption, it is important to use a strong hashing algorithm and a unique salt for each password to enhance security. Additionally, it is recommended to store the salt separately from the hashed password for added security.

$password = "password123";
$salt = uniqid(mt_rand(), true);
$hashed_password = crypt($password, '$2a$10$' . $salt);