x = int(3) , y = float(0) , x / y = float(INF)
x = int(3) , y = int(0) , x / y = float(INF)
x = int(3) , y = float(-0) , x / y = float(-INF)
x = int(-3) , y = float(0) , x / y = float(-INF)
x = int(-3) , y = int(0) , x / y = float(-INF)
x = int(-3) , y = float(-0) , x / y = float(INF)
As we can see, PHP treats int(0) exactly as float(+0.0) — this is incorrect, IMO. I think, PHP shouldn't treat it neither like float(+0.0) nor like float(-0.0) — because PHP doesn't know what exactly is it. That's why, IMO, PHP shouldn't return ±INF, but NAN when attempted to divide 3/int(0) — because PHP doesn't know is it 3/float(+0.0) or 3/float(-0.0) (which evaluates to +INF and -INF respectively — it's a huge difference).
Here is the code, that produced output provided above:
<?php
error_reporting(0);
function dbg($x, $y) {
$d = $x / $y;
echo 'x = ';
var_dump($x);
echo ', y = ';
var_dump($y);
echo ', x / y = ';
var_dump ($d);
echo '<br />';
}
dbg(+3, +0.0);
dbg(+3, 0);
dbg(+3, -0.0);
dbg(-3, +0.0);
dbg(-3, 0);
dbg(-3, -0.0);
?>