Php Objective Questions with Answers for written test exams 14

Question 14
Why must you call session_start() prior to any output?

A. Because it is easy to forget if not placed at the top of your scripts.

B. Because you can no longer access the session data store after there has been

output.

C. Because session_start() sets some HTTP headers.

D. Because calling session_start() causes the HTTP headers to be sent.
Answers 14


Answer C is correct. Answer A is incorrect because this is a technical necessity, not

a best practice. Answer B is incorrect because accessing the session data store is

completely independent of whether there has been any output. Answer D is incorrect

because you can set other HTTP headers after a call to session_start().

  







Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---