How can we destroy the session, how can we unset the
variable of a session?

Answers were Sorted based on User's Feedback



How can we destroy the session, how can we unset the variable of a session?..

Answer / sreenia

the better way of destroying a session is to first unset all
the values of $_SESSION variables individually, and then use
the session_destroy() function

Is This Answer Correct ?    17 Yes 6 No

How can we destroy the session, how can we unset the variable of a session?..

Answer / devendrarjadav

session_destroy() function destroys all data registered to
current session. use unset function to destroy varible
specified with session. So to destroy $name registered with
session use unset($name) in your php script.

Is This Answer Correct ?    16 Yes 6 No

How can we destroy the session, how can we unset the variable of a session?..

Answer / sri harsha

session can be destroyed by using session_destroy() function
and variable can be unset by unset($_session['name']).

Is This Answer Correct ?    11 Yes 3 No

How can we destroy the session, how can we unset the variable of a session?..

Answer / murali

session can be destroyed by using session_destroy() function
and variable can be unset by unset($_session['name']), and
also write like this...
$_session['name']=='';
you can assign null.

Is This Answer Correct ?    5 Yes 0 No

How can we destroy the session, how can we unset the variable of a session?..

Answer / pawan chhabra

// Create a logout.php file then..

<?php
session_start();
header("location:login.php");
session_destroy();
??

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More PHP Interview Questions

Suppose your Zend engine supports the mode <? ?> Then how can u configure your PHP Zend engine to support <?PHP ?> mode ?

1 Answers   Rushmore Consultancy,


What is scope of variable in php?

0 Answers  


How do I escape in php?

0 Answers  


Tell me what types of loops exist in php?

0 Answers  


What is a query give example?

0 Answers  






How do i explode this string '||25||34||73||94||116||128' i need to have a array like this array ( 0 => '25', 1 => '34', 2 => '73', 3 => '94', 4 => '116', 5 => '128' ) explode("||", $array); didnt work for me i get this array array ( 0 => '', 1 => '25', 2 => '34', 3 => '73', 4 => '94', 5 => '116', 6 => '128', )

2 Answers  


What is MVC structure in Magento?

4 Answers  


How many data types are there in php?

0 Answers  


What are php libraries?

0 Answers  


What is default session time and path in php?

0 Answers  


List out different arguments in PHP header function?

4 Answers  


How can we find the number of rows in a result set using PHP?

4 Answers  


Categories