Why is it recommended to use a secure hashing function for passwords instead of SHA1 in PHP?

It is recommended to use a secure hashing function for passwords instead of SHA1 in PHP because SHA1 is no longer considered secure for storing passwords due to vulnerabilities that make it susceptible to brute force attacks. To improve security, it is better to use stronger hashing algorithms like bcrypt or Argon2, which are specifically designed for password hashing and are more resistant to attacks.

// Using bcrypt for password hashing
$hashed_password = password_hash($password, PASSWORD_BCRYPT);