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 7003867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:07:30+00:00 2026-05-27T21:07:30+00:00

What does isset($_SESSION) mean? I found the following code snippet- if (!isset($_SESSION)) { //

  • 0

What does isset($_SESSION) mean? I found the following code snippet-

if (!isset($_SESSION)) {

// php code

}

EDIT:

I found the following snippet in define.php of the facebook style chatting script
freichat :

if (!isset($_SESSION)) {
            $this->frm_id = $_SESSION[$this->uid . 'usr_ses_id'];
            $this->frm_name = $_SESSION[$this->uid . 'usr_name'];
        }

if $_SESSION was not set previously then, how can the two session variables be assigned to other variables?

  • 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-27T21:07:31+00:00Added an answer on May 27, 2026 at 9:07 pm

    Summary from my comments:

    • isset determines if a variable is set and is not NULL.
    • Putting an ! negates the condition, so if (!false) will evaluate to true.
    • $_SESSION is a superglobal and will be available on the following conditions:

    Please note when working with sessions that a record of a session is not created until a variable has been registered using the session_register() function or by adding a new key to the $_SESSION superglobal array. This holds true regardless of if a session has been started using the session_start() function.

    Your if (!isset($_SESSION)) will evaluate to true when no Session exists yet. It will then execute the code in the if block. However, that code will not work. If you run this snippet

    <?php
    var_dump($_SESSION);                // undefined notice + NULL
    var_dump(isset($_SESSION));         // FALSE
    if (!isset($_SESSION)) {            // !FALSE is TRUE
        $foo = $_SESSION['usr_ses_id']; // undefined notice
    }
    var_dump($foo);                     // NULL
    var_dump($_SESSION);                // still undefined undefined + NULL
    

    you will see that it outputs:

    Notice: Undefined variable: _SESSION in /code/Kx2RMF on line 2
    NULL 
    bool(false)
    Notice: Undefined variable: _SESSION in /code/Kx2RMF on line 5
    NULL
    Notice: Undefined variable: _SESSION in /code/Kx2RMF on line 8
    NULL 
    

    So unless I am missing something, I’d say the code in that chat script makes no sense.

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

Sidebar

Related Questions

Simple question, simple code. This works: $x = &$_SESSION['foo']; This does not: $x =
I have a login script that does this: $_SESSION['username']=$username; $_SESSION['password']=$password; If the user logged
Should this function be: check_login_session() { if (!isset[$_SESSION['user_auth']) ) { header('Location: login.php'); } else
Why does if (isset($_SESSION['location']) AND !empty($_SESSION['location'])) work while if (isset($_SESSION['location']) && !empty($_SESSION['location'])) does not?
Can anyone please explain to me why the following code does not set the
I have a PHP script that does some validation, and if the validation is
Does Google force employees who have offers from Facebook to leave immediately?
I made the following code that works with the Google Tasks API but it
I'm getting following messages and I don't know what they mean. Everything seems to
<?php session_start(); include(connect.php); $timeout = 60 * 30; $fingerprint = md5($_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT']); if(isset($_POST['userName']))

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.