In PHP, lets create a variable and set it value to 0
:
$x = 0;
echo $x;
it would display 0
. If one would multiply that 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 would get the output: -0
.
Why is that? Shouldn't zero be always displayed unsigned, regardless of its underlying type?