1. Home
  2. Computer Science MCQs
  3. PHP
  4. Which of the following is a valid way to start a PHP…

Added 23 Jan 2024

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

  1. session_begin()
  2. start_session()
  3. session_start() Correct answer
  4. begin_session()

Correct answer

C. session_start()

12 views

MCQSEXAM

Explanation

session_start() starts a new session or resumes the existing one, and must be called before any output is sent to the browser because it sets a cookie header.

After it runs, the $_SESSION array becomes available. The other names in the options look plausible but do not exist in PHP.

Practise more Computer Science MCQs with answers and explanations on MCQsExam.com.

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