What potential security risks are present in storing passwords as plaintext in a PHP application?

Storing passwords as plaintext in a PHP application poses a significant security risk because if the database is compromised, all user passwords can be easily accessed and used by malicious actors. To mitigate this risk, passwords should be securely hashed using a strong hashing algorithm like bcrypt before storing them in the database.

// Hashing a password before storing it in the database
$password = 'user_password';
$hashed_password = password_hash($password, PASSWORD_DEFAULT);

// Storing the hashed password in the database
// $hashed_password should be saved in the database instead of the plaintext password