Bird
0
0

Which of the following best describes the effect of calling session_destroy() in PHP?

easy📝 Conceptual Q1 of 15
PHP - Sessions and Cookies
Which of the following best describes the effect of calling session_destroy() in PHP?
AIt clears the session variables but keeps the session active.
BIt deletes all data associated with the current session on the server.
CIt removes the session cookie from the user's browser.
DIt restarts the session with a new session ID.
Step-by-Step Solution
Solution:
  1. Step 1: Understand session_destroy()

    The session_destroy() function removes all data stored in the current session on the server.
  2. Step 2: What it does not do

    It does not unset session variables or delete the session cookie automatically.
  3. Final Answer:

    It deletes all data associated with the current session on the server. -> Option B
  4. Quick Check:

    session_destroy() affects server data only [OK]
Quick Trick: session_destroy() removes server session data only [OK]
Common Mistakes:
  • Thinking session_destroy() clears $_SESSION variables immediately
  • Assuming session_destroy() deletes the session cookie automatically
  • Believing session_destroy() regenerates session ID

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes