Bird
0
0

Which of the following is the correct way to start a session in PHP to keep variables between requests?

easy📝 Syntax Q12 of 15
PHP - Request Lifecycle
Which of the following is the correct way to start a session in PHP to keep variables between requests?
Asession_start();
Bstart_session();
Cbegin_session();
Dinit_session();
Step-by-Step Solution
Solution:
  1. Step 1: Recall PHP session function

    The correct function to start a session is session_start();.
  2. Step 2: Verify syntax correctness

    Other options are not valid PHP functions and will cause errors.
  3. Final Answer:

    session_start(); -> Option A
  4. Quick Check:

    Use session_start() to begin sessions [OK]
Quick Trick: Remember exact function name: session_start() [OK]
Common Mistakes:
  • Using incorrect function names like start_session()
  • Forgetting parentheses after function name
  • Not calling session_start() before output

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes