If variable value is 0 (float) it will pass all these tests:
$test = round(0, 2); //$test=(float)0
if($test == null)
echo "var is null";
if($test == 0)
echo "var is 0";
if($test == false)
echo "var is false";
if($test==false && $test == 0 && $test==null)
echo "var is mixture";
I assumed that it will pass only if($test == 0)
Only solution I found is detect if $test is number using function is_number(), but can I detect if float variable equal zero?
Using ===
checks also for the datatype:
$test = round(0, 2); // float(0.00)
if($test === null) // false
if($test === 0) // false
if($test === 0.0) // true
if($test === false) // false