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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:36:49+00:00 2026-05-13T18:36:49+00:00

Considering that: The isset() construct returns TRUE if a variable is set and not

  • 0

Considering that:

  • The isset() construct returns TRUE if a variable is set and not NULL
  • The is_null() function throws a warning if the variable is not set

Is there a way to test whether a variable exists, no matter it’s NULL or not, without using the @ operator to suppress the notice?


EDIT

Together with your first replies, I’ve been thinking about this and I’m getting the conclusion that inspecting get_defined_vars() is the only way to distinguish between a variable set to NULL and an unset variable. PHP seems to make little distinctions:

<?php

$exists_and_is_null = NULL;

// All these are TRUE

@var_dump(is_null($exists_and_is_null));
@var_dump(is_null($does_not_exist));

@var_dump($exists_and_is_null===NULL);
@var_dump($does_not_exist===NULL);

@var_dump(gettype($exists_and_is_null)=='NULL');
@var_dump(gettype($does_not_exist)=='NULL');

?>
  • 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-13T18:36:50+00:00Added an answer on May 13, 2026 at 6:36 pm
    $result = array_key_exists('varname', get_defined_vars());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Considering that this is a very basic task, I could not think of an
Considering that the family of iDevices is expanding, I guess this is a problem
Considering that I'll be using Vim as my text editor of choice, what tools
Hey, I'm learning C# and just thought of a cool idea. Considering that a
I'm looking to implement a build system that will run unit tests and JSLint
Can you suggest me any good anti-crack approaches (other than a code obfuscation), considering
I had a JSP file with a c:redirect tag that would forward along a
Given a range of indexes (identifiers), where I want to map each index to
I've never heard anyone speak of CORBA in anything but derisive terms which is
What is the best Maven archetype to use on enterprise application in java using

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.