Bird
0
0

What is a primary benefit of using PHP sessions instead of cookies for storing user data?

easy📝 Conceptual Q1 of 15
PHP - Sessions and Cookies
What is a primary benefit of using PHP sessions instead of cookies for storing user data?
ASessions can be accessed by client-side JavaScript.
BSessions store data on the server, enhancing security.
CSessions automatically persist after browser closure.
DSessions require no server resources.
Step-by-Step Solution
Solution:
  1. Step 1: Understand where data is stored

    Cookies store data on the client side, while sessions store data on the server.
  2. Step 2: Consider security implications

    Since sessions keep data on the server, they are less vulnerable to client-side tampering.
  3. Final Answer:

    Sessions store data on the server, enhancing security. -> Option B
  4. Quick Check:

    Sessions = server-side storage [OK]
Quick Trick: Sessions store data server-side, safer than cookies [OK]
Common Mistakes:
  • Thinking sessions store data on the client
  • Assuming sessions persist after browser closes
  • Believing sessions require no server resources

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes