Php Objective Questions with Answers for written test exams 15

Question 15
Which of the following represents the proper way to set a session variable?

A. $_SESSION[‘foo’] = ‘bar’;

B. session_start();

C. session_set_save_handler (‘myopen’, ‘myclose’, ‘myread’,

‘mywrite’, ‘mydelete’, ‘mygarbage’);

D. $foo = $_SESSION[‘foo’];
Answers 15


Answer A is correct. Answer B is incorrect because session_start() only activates

PHP sessions for the current script. Answer C is incorrect because

session_set_save_handler() allows you to override PHP’s default session

mechanism with your own custom functions. Answer D is incorrect; session data is

being used as the value of a regular variable and is not being manipulated in any

way.

  







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 ---