What is the recommended function for hashing passwords in PHP to avoid security vulnerabilities?

To avoid security vulnerabilities when hashing passwords in PHP, it is recommended to use the `password_hash()` function with the `PASSWORD_DEFAULT` algorithm. This function securely hashes passwords using a strong one-way hashing algorithm, making it difficult for attackers to reverse engineer the original password. Additionally, it automatically handles salting, which adds an extra layer of security to the hashed password.

$password = "secretPassword";
$hashedPassword = password_hash($password, PASSWORD_DEFAULT);

// Store $hashedPassword in your database for later verification