Bird
0
0

Which of the following is the correct way to start a session in PHP?

easy📝 Syntax Q12 of 15
PHP - Sessions and Cookies
Which of the following is the correct way to start a session in PHP?
Asession.begin();
Bstart_session();
Csession_start();
Dbegin_session();
Step-by-Step Solution
Solution:
  1. Step 1: Recall PHP session function syntax

    The correct function to start a session is session_start() with an underscore and parentheses.
  2. Step 2: Check other options for syntax errors

    Options B, C, and D are not valid PHP functions and will cause errors.
  3. Final Answer:

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

    Correct PHP session start syntax = A [OK]
Quick Trick: Use exact function name: session_start() [OK]
Common Mistakes:
  • Using wrong function names like start_session()
  • Missing parentheses after session_start
  • Using camelCase instead of underscore

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes