What is the best practice for securely storing sensitive information like passwords in cookies?

Storing sensitive information like passwords in cookies is not recommended as cookies are stored on the client-side and can be easily accessed or manipulated. Instead, it is best practice to store sensitive information on the server-side in a secure manner, such as using sessions or database storage.

// Do not store sensitive information like passwords in cookies
// Store sensitive information securely on the server-side

// Example of storing sensitive information in a session
session_start();
$_SESSION['password'] = password_hash('sensitivepassword', PASSWORD_DEFAULT);