SESSION doubt

Discussion in 'PHP' started by gr8webseller, Nov 16, 2009.

  1. #1
    I am learning PHP, today, i got a doubt about session,,,,,

    here is the code
    
    	session_start();
    
    	if ((isset($_GET['action'])) && ($_GET['action'] == 'true')){
    		$_SESSION = array();
    		session_destroy();
    	}
    
    PHP:
    first session is started using "session_start()" function,,,

    i cant understand next two lines, can anyone please explain
     
    gr8webseller, Nov 16, 2009 IP
  2. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #2
    if condition checks whether "action" parameter received using GET method of HTML is set or not. IF it is set, assign a blank array to $_SESSION and destroy the session after that :)
     
    mastermunj, Nov 16, 2009 IP
  3. gr8webseller

    gr8webseller Peon

    Messages:
    1,097
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #3
    can u please say what is the use of assigning a blank array for $_SESSION
     
    gr8webseller, Nov 16, 2009 IP
  4. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #4
    its for resetting the $_SESSION :)

    To cleanup session one can assign a blank array to it :)
     
    mastermunj, Nov 16, 2009 IP
  5. gr8webseller

    gr8webseller Peon

    Messages:
    1,097
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #5
    thank you very much
     
    gr8webseller, Nov 16, 2009 IP