How can we destroy the session, how can we unset the
variable of a session?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
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 |
Can I run php without xampp?
How can we extract string 'abc.com' from a string "http://info@abc.com" using regular expression of PHP
What is the functionality of the functions strstr() and stristr()?
What are the advantages of using php?
Which function would you use to read a line of data from a file in php?
What are the uses of php language?
Explain me how to include a file to a php page?
What is php programming used for?
What is the difference between associative array and indexed array?
How can I check if a value is already in an array?
3 Answers Rushmore Consultancy,
What is the function to count elements in an array in PHP?
How can we enable error reporting in php?