I want to round the number and get a proper integer to make it an array key. This is the answer that I know:
$key = (int)round($number)
As far as I know (int) just truncates any decimals and since round($number) returns a float with theoretically limited precision, is it possible that round($number) returns something like 7.999999... and then $key is 7 instead of 8?
Is there any better solution to do this?