I have this code:
$val = (float) $desc;
if (!isset($runepage['statistics'][$key])) {
$runepage['statistics'][$key] = (float) 0.0;
}
$runepage['statistics'][$key] += $val;
where $val is a float.
But when I print out the array at the end all the values end up as integers. For example, if there were 1.5, 1.5, 1.5 for the same $key, it would print out 3 rather than 4.5.
I'm not sure why it's doing this.
Edit: here's the output of the array
[statistics] => Array
(
[magic penetration] => 9
[ability power per level] => 9
[movement speed] => 3
[magic resist] => 9
)
(float) 0.0by the way - a zero here will suffice, and it will still be treated as float.key_3.5rather than3.5.