PHP Interview Question and Answers:
6. How do you destroy a particular or all Sessions?<?php
session_start();
// store session data
$_SESSION['views']=1;
unset($_SESSION['views']); // If you wish to delete some session data, you can use the unset()
session_destroy(); // You can also completely destroy the session by calling the session_destroy() function. session_destroy() will reset your session and you will lose all your stored session data.
?>
7. What are the different functions in sorting an array?
asort()
arsort()
ksort()
krsort()
uksort()
sort()
natsort()
rsort()
8. How many ways we can pass the variable through the navigation between the pages?
Register the variable into the session
Pass the variable as a cookie
Pass the variable as part of the URL
9. What Is a Session?
A session is a logical object created by the PHP engine to allow you to preserve data across subsequent HTTP requests. Sessions are commonly used to store temporary data to allow multiple PHP pages to offer a complete functional transaction for the same visitor.
10. How can we register the variables into a session?
<?php
session_register($ur_session_var);
?>
No comments:
Post a Comment