I've stumbled upon unusual PHP behaviour.
First of all let me say that it was pure interest and was never intended to be used in a production
$my_array = array(NAN => "one", INF => "two");
print_r($my_array);
The result is
Array
(
[-2147483648] => one
[0] => two
)
Can please anyone explain me how come
they do not generate warnings (especially INF casted to 0 that overrides other value with the same key if any)
why NAN casts to −9,223,372,036,854,775,808 on 64bit and -2,147,483,648 on 32bit machine (lowest long you can get)
INF silently becomes zero
I can see NAN and INF become those numbers if casted to int but would not it be more logical if NAN would cast 0 and INF would be maximum positive number?