What is the difference between Sesson unset() and session_destroy().

Discussion in 'PHP' started by Shefaligarg, May 16, 2011.

  1. #1
    Hi can any tell me something about the difference between Sesson unset() and session_destroy().
     
    Shefaligarg, May 16, 2011 IP
  2. lukeg32

    lukeg32 Peon

    Messages:
    645
    Likes Received:
    19
    Best Answers:
    1
    Trophy Points:
    0
  3. Projekt.Gopher

    Projekt.Gopher Peon

    Messages:
    36
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    unset will allow you to unset one variable, where destroy will destroy the entire session.
     
    Projekt.Gopher, May 17, 2011 IP
  4. ezprint2008

    ezprint2008 Well-Known Member

    Messages:
    611
    Likes Received:
    15
    Best Answers:
    2
    Trophy Points:
    140
    Digital Goods:
    1
    #4
    when you unset a session it can be reset loading into a newpage , where only session destroy will permanently destroy it.
    It would seem that session unset should to it , but it wont and the variable will keep popping back up on SESSIONS unless you use destroy.
    Also, the way to unset and destroy is to name the sessions you want to unset ..and then at the end of that name the session destroy ..to destroy them all
    If you use session destroy though, it will destroy all those sessions, so unset was supposed to work to unset the specific sessions like one of them out of 100 sessions,but sometimes dependingon browseretc, sessions unset can reactivate.
     
    ezprint2008, May 19, 2011 IP