Which is the most secure way to avoid storing a password in clear text in database?

✅  The correct answer is:

$encrypted = password_hash($password, PASSWORD_DEFAULT);

Question:

Which is the most secure way to avoid storing a password in clear text in database?

Solution:

  • $encrypted = shal($password);
  • $encrypted = crypt($password, \$salt);
  • $encrypted = md5($password);
  • $encrypted = password_hash($password, PASSWORD_DEFAULT);