What are the potential risks of storing passwords in a hashed format using a one-way encryption method in PHP?

Storing passwords in a hashed format using a one-way encryption method in PHP is generally a secure practice. However, one potential risk is that weak hashing algorithms or improper implementation can make the passwords vulnerable to brute force attacks or rainbow table attacks. To mitigate this risk, it is important to use strong hashing algorithms like bcrypt and properly salt the passwords before hashing.

// Hashing and salting passwords using bcrypt
$password = "password123";
$salt = uniqid(mt_rand(), true);
$hashed_password = password_hash($password . $salt, PASSWORD_BCRYPT);