What are the potential security risks associated with storing passwords in plain text or using insecure hashing methods in PHP applications?

Storing passwords in plain text or using insecure hashing methods in PHP applications can expose users to significant security risks. If a database breach occurs, attackers can easily access all user passwords, leading to potential account compromises on other platforms if users reuse passwords. To mitigate this risk, passwords should be securely hashed using strong algorithms like bcrypt before storing them in the database.

// Hashing a password using bcrypt
$password = "password123";
$hashedPassword = password_hash($password, PASSWORD_BCRYPT);