I have to check that the value is defined as something, including zero. The isset
assumes the undefined null and returns as the false
example:
$ foo = null; If (isset ($ foo)) // return returns if (isset ($ bar)) // return falls if (isset ($ foo) || is_null ($ foo)) // returns true if (isset ($ bar)
Note that $ bar
is undefined.
I need to find a condition that satisfies the following:
if (some ($ bar)) // wrong; If (some ($ foo)) // returns correct;
Any ideas?
IIRC, you can use it for:
$ Foo = NULL; $ Vars = get_defined_vars (); If (array_key_exists ('bar', $ wars)) {}; // should be evaluated at FALSE (array_key_exists ('foo', $ vars)) {}; // should be evaluated to correct
Comments
Post a Comment