In php, ($myvariable==0)
When $myvariable is zero, the value of the expression is true; when $myvariable is null, the value of this expression is also true. How
There's an is_null function, but this will just replace your $myvariable!=null
$myvariable === 0
read more about comparison operators.
For my case i found this soulution and it works for me :
if ($myvariable === NULL) {
codehere...
}
Try ($myvariable === 0)
which will not perform type coercion.
If your zero could be a string, you should also considere checking the "zero string"
($myvariable === 0 || $myvariable === '0')
To identify as null or zero by:
is_int($var)
if a variable is a number or a numeric string. To identify Zero, use is_numeric($var)
is also the solution or use $var === 0
is_null($var)
if a variable is NULL