Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3934800
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:45:26+00:00 2026-05-19T23:45:26+00:00

I must be really stupid because it seems a fairly obvious thing is completely

  • 0

I must be really stupid because it seems a fairly obvious thing is completely confusing me right now.

I have a session…

ie $_SESSION['handbag_id'];

and at a certain point, I need to completely kill this session.

ie

// at the start of the page
session_start();

// elsewhere on the same page
unset($_SESSION);
session_destroy();

And yet, I can then go to another page, and do a

echo $_SESSION['handbag_id'];

And I’ve still got the same handbag_id as before.

What am I missing? Do I not understand how this works or do I have some server setting that reigns supreme over my desire to destroy its values?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T23:45:26+00:00Added an answer on May 19, 2026 at 11:45 pm

    Session functions can be very tricky. To completely kill a session you need to assign a new value to the $_SESSION superglobal. Otherwise, all you do is unloading session data from current script. This should work:

    session_start();
    $_SESSION = array();
    session_write_close(); // Not required
    

    If you also need to open an entirely new session, you can do this:

    session_regenerate_id(FALSE);
    $tmp = session_id();
    session_destroy();
    session_id($tmp);
    unset($tmp);
    session_start();
    

    Update:

    A related question you may find useful: Close session and start a new one

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm feeling very, very stupid right now... I feel like I must be missing
I'm trying out my first Spring project and must be doing something really stupid
I must really be missing something obvious, but I'm having trouble with general use
This must be really obvious, but how do I make a winsock listen to
I must be doing something wrong here (because really, what are the chances of
I must admit that I don't really know if this is the right place
I'm really sorry. This must seem like an incredibly stupid question, but unless I
This must be a really stupid question, but I'm still very green when it
I must be doing something really stupid here, but I've been beating my head
this is a really stupid question but I have a deadline and I'm very

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.