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

  • SEARCH
  • Home
  • 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 7520917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:08:58+00:00 2026-05-30T02:08:58+00:00

I have a tricky question. lets say if we start naming session as :

  • 0

I have a tricky question. lets say if we start naming session as :

$_SESSION[‘user-msg’], $_SESSION[‘user-err’], $_SESSION[‘user-name’],
$_SESSION[‘admin-msg’], $_SESSION[‘admin-err’],
$_SESSION[‘admin-username’]

what if i just want to destroy session those are having key as “user-” only? how we do that?

actually i want to log out admin (backend) only. while the same person is logged in as user on my front end.

  • 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-30T02:09:00+00:00Added an answer on May 30, 2026 at 2:09 am

    Something like this:

    $prefix='user-';
    foreach($_SESSION as $key => $val)
       if (substr($key, 0, strlen($prefix)) === $prefix)
           unset($_SESSION[$key]);
    

    I don’t think there exists any better option.

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

Sidebar

Related Questions

One more question about the sticky footer css... lets say i have the following
I have a little tricky question. I have a Telerik Grid with some ClientSide
A slightly tricky SQL question (we are running SQL server 2000). I have the
This sounds like a tricky question... let me ellaborate... I have a treeView. When
I have a tricky question regarding to what i'm trying to do. I have
I have a tricky question regarding shallow serialization of List of objects my entities
I have a potentially stupid question about a potentially stupid database design. Say I
I have a tricky question and I'm not sure if it is even possible
This is a bit tricky question for you computer scientists. Let's say that I
I have a tricky question (at least in my perspective), regarding Scalas parser combinators

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.