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

How to link one site backend to another site frontend?

0 Answers   Global Logic,


How to convert any type of video formate in flv formate in php can any buddy give me coding.

1 Answers  


How many ways we can give the output to a browser?

6 Answers  


What is the scope of a variable defined outside a function?

0 Answers  


What are the 3 scope levels available in php and how would you define them?

0 Answers  


Does php support function overloading?

0 Answers  


What is $$ in php?

0 Answers  


Why laravel is the best php framework in 2019?

0 Answers  


Can you pass an array into a function?

0 Answers  


Tell me is it possible to submit a form with a dedicated button?

0 Answers  


How escape single quotes php?

0 Answers  


How to create a mysql connection in php?

0 Answers  


Categories