Reputation: 140
if (isset($_POST['clear'])) {
session_unset($_SESSION['dataRow']);
session_unset($_SESSION['dataColumn']);
session_destroy();
echo ' Data has been deleted. ';
}
Upvotes: 1
Views: 794
Reputation: 2599
Unset will destroy a particular session variable while session_destroy() will destroy all the session data for that user.
It depends on your application how to use it, just keep this in mind:
unset($_SESSION['name']); // will delete just the name data
session_destroy(); // will delete ALL data associated with that user.
Upvotes: 5