php session destroy not working

Solutions on MaxInterview for php session destroy not working by the best coders in the world

showing results for - "php session destroy not working"
Anna
16 Jan 2019
1//After using session_destroy(), the session is destroyed behind the scenes. For some reason this doesn't affect the values in $_SESSION, which was already populated for this request, but it will be empty in future requests.
2
3//You can manually clear $_SESSION if you so desire ($_SESSION = [];).
4 <?php
5 $_SESSION = [];
6 session_unset();
7 session_destroy();
8?>
Flavien
24 Sep 2019
1//make sure you don't forget to initialize session before destroying it
2session_start() ;
3session_destroy();
4$_SESSION = [];//and clear it for this request