Hello dear friends..
I have some confusion in following code.


$_SESSION["name"]= "abc";


echo $_SESSION["name"];

as I am assigning value to session variable, after assigning I am destroying whole session but after destroying as I echo $_SESSION["name"] it show value.
It is printing value even session has been destroyed..
Can any one tell me its reason.

A quote from the PHP session_destroy manual

session_destroy() destroys all of the data associated with the current session. It does not unset any of the global variables associated with the session, or unset the session cookie. To use the session variables again, session_start() has to be called.

In order to kill the session altogether, like to log the user out, the session id must also be unset. If a cookie is used to propagate the session id (default behavior), then the session cookie must be deleted. setcookie() may be used for that.

If you create a logout.php to end user session, do not forget to start the session in this page!, using session_start() at the very begging of your script. Thus,


will be the right sequence to end a user's session.
This is a very basic concept, but took me a while to realize I was forgetting to start the session.


Thanks dear...
bus still I have confusion like on same page it is showing session variable are set.
but as on second page I start session and the write print_r($_SESSION).. the output is array() mean session array have no item.