Is null the same as 0 in php?
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8) Show is_null — Finds whether a variable is Descriptionis_null(mixed Parametersvalue The variable being evaluated. Return Values Returns ExamplesExample #1 is_null() example
(E_ALL);$foo = NULL; Notice: Undefined variable: inexistent in ... bool(true) bool(true) See Also
Malfist ¶ 14 years ago
george at fauxpanels dot com ¶ 13 years ago
contact dot 01834e2c at renegade334 dot me dot uk ¶ 7 years ago
ahamilton9 ¶ 5 months ago
ai dot unstmann at combase dot de ¶ 14 years ago
= array(null, true, false, 0, 1, '', "\0", "unset"); etimjoshua4 at gmail dot com ¶ 1 year ago
strrev xc.noxeh@ellij ¶ 14 years ago
normadize (a) gmail (d) com ¶ 10 years ago
michael at cannonbose dot com ¶ 18 years ago
WHAT IS null value in PHP?Null is a special data type in PHP which can have only one value that is NULL. A variable of data type NULL is a variable that has no value assigned to it. Any variable can be empty by setting the value NULL to the variable.
Does 0 count as empty PHP?The following things are considered to be empty: "" (an empty string) 0 (0 as an integer) 0.0 (0 as a float)
Why is null not equal to zero?You can think of it as this, Null just means the value is "undefined". But "0" defines the variable to be an integer, 0 is a value! Null is not declared to be anything. Therefore it is false.
Is 0 considered empty?"0" is considered as no value or empty value.
|