How does the PHP crypt function enhance password security compared to other hashing algorithms?

The PHP crypt function enhances password security compared to other hashing algorithms by allowing for the use of different hashing algorithms and salts, making it more difficult for attackers to crack passwords through brute force or dictionary attacks.

$password = "password123";
$salt = '$2a$07$usesomesillystringforsalt$';
$hashed_password = crypt($password, $salt);

// Store $hashed_password in the database