<?php
$a = [0, 0.0, "0", "asdf", ''];
foreach ($a as $isZero) {
var_dump($isZero, floatval($isZero) === 0.0);
echo "\n";
}
- Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
- int(0)
bool(true)
float(0)
bool(true)
string(1) "0"
bool(true)
string(4) "asdf"
bool(true)
string(0) ""
bool(true)
preferences:
148.98 ms | 404 KiB | 211 Q