IIRC, you can use get_defined_vars()
for this:
$foo = NULL;
$vars = get_defined_vars();
if (array_key_exists('bar', $vars)) {}; // Should evaluate to FALSE
if (array_key_exists('foo', $vars)) {}; // Should evaluate to TRUE
More Related Contents:
- What is the difference between null and empty?
- Php if($var) used to work [closed]
- Search Form with One or More (Multiple) Parameters
- json_encode is returning NULL?
- Why I am getting Cannot pass parameter 2 by reference error when I am using bindParam with a constant value?
- Null vs. False vs. 0 in PHP
- PHP json_decode() returns NULL with valid JSON?
- If isset $_POST
- php is null when empty? [duplicate]
- Best way to test for a variable’s existence in PHP; isset() is clearly broken
- What’s the difference between ‘isset()’ and ‘!empty()’ in PHP?
- PHP/MySQL Insert null values
- In where shall I use isset() and !empty()
- Delete multiple rows by selecting checkboxes using PHP
- How to store NULL values in datetime fields in MySQL?
- check if variable empty
- Using if(isset($_POST[‘submit’])) to not display echo when script is open is not working
- PHP Error : Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` [duplicate]
- Calling a particular PHP function on form submit
- using nulls in a mysqli prepared statement
- What is the PHP shorthand for: print var if var exist
- PHP: Check if variable exist but also if has a value equal to something
- PHP Check for NULL
- Passing null to non-nullable internal function parameters – Updating Existing Code Base to php 8.1
- MySQL and PHP – insert NULL rather than empty string
- How to select rows where column value IS NOT NULL using CodeIgniter’s ActiveRecord?
- PHP constructor to return a NULL
- PHP shorthand for isset()? [duplicate]
- MySQL, how to insert null dates
- Why does PHP not complain when I treat a null value as an array like this?