In PHP, create a variable and set its value to 0
:
$x = 0; echo $x;
0
displayed. If you multiply this by -1
:
$x = -1 * $x; echo $x;
we still see 0
. But if $x
is a float:
$x = 0; $x = (float)$x; $x = -1 * $x; echo $x;
we get the result: -0
.
Why? Shouldn't you always show zero unsigned, regardless of its base type?
Gacek source share