PHP Sessions
- What is the return type of session_set_save_handler() function?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Returns TRUE on success or FALSE on failure.
- Which function is used to erase all session variables stored in the current session?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
This will not completely remove the session from the storage mechanism. If you want to completely destroy the session, you need to use the function session_destroy().
- What will the function session_id() return is no parameter is passed?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Previous Session Identification Number
- Which one of the following statements should you use to set the session username to Manjesh?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
You need to refer the session variable ‘username’ in the context of the $_SESSION superglobal.
- What will be the output of the following PHP code? Say your previous session username was Manjesh.
unset($_SESSION['username']);
printf("Username now set to: %s", $_SESSION['username']);
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
To delete the session variable ‘username’ we use the unset() function.