I mean... I "set" it to NULL
. So isset($somethingNULL) == true
?
Definition and Usage The isset() function determines whether a variable is set. To be considered a set, it should not be NULL. Thus, the isset() function also checks whether a declared variable, array or array key has a null value. It returns TRUE when the variable exists and is not NULL; else, it returns FALSE.
The isset() function is an inbuilt function in PHP which checks whether a variable is set and is not NULL. This function also checks if a declared variable, array or array key has null value, if it does, isset() returns false, it returns true in all other possible cases.
is_bool($var): The function is_bool() checks whether a variable's type is Boolean and returns true or false. Comparison using “===” or ($var===true || $var===false): If you compare the variable with the operator “===” with true and false and if it is identical to one of the values, then it is a boolean value.
isset() : You can use isset() to determine if a variable is declared and is different than null . empty() : It is used to determine if the variable exists and the variable's value does not evaluate to false . is_null() : This function is used to check if a variable is null .
bool isset ( mixed $var [, mixed $var [, $... ]] )
Determine if a variable is set and is not NULL.
If a variable has been unset with unset(), it will no longer be set. isset() will return FALSE if testing a variable that has been set to NULL. Also note that a NULL byte ("\0") is not equivalent to the PHP NULL constant.
Return values
Returns TRUE if var exists and has value other than NULL, FALSE otherwise.
From the manual. Examples on the same page.
Yes - from the ISSET() documentation:
$foo = NULL;
var_dump(isset($foo)); // FALSE
/* Array example */
$a = array ('test' => 1, 'hello' => NULL);
var_dump(isset($a['test'])); // TRUE
var_dump(isset($a['foo'])); // FALSE
var_dump(isset($a['hello'])); // FALSE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With