1. Home
  2. Computer Science MCQs
  3. PHP
  4. Which PHP function should be used to store user passwords…

Added 2 Nov 2026

Which PHP function should be used to store user passwords securely?

  1. md5()
  2. base64_encode()
  3. password_hash() Correct answer
  4. sha1()

Correct answer

C. password_hash()

17 views

MCQSEXAM

Explanation

password_hash() generates a salted, slow hash (bcrypt by default), and password_verify() checks it. MD5 and SHA-1 are fast and easily cracked, and Base64 is just an encoding, not protection.

Reference

Asked in: NTS, PHP Developer Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is C? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More PHP MCQs

Practise all PHP MCQs

Similar MCQs