Are PHP Integer array Indexes really numeric?
Q1. Because 00 = 0 numerically
Q2. Because the index is "00"
not 00
Try:
$test=array(00=>"A","B","C","D","E");print_r($test);/*Array( [0] => A [1] => B [2] => C [3] => D [4] => E)*/
Q3.
echo gettype("00");# stringecho gettype(00);# integerecho gettype("0");# stringecho gettype(0);# integer
From the manual:http://php.net/manual/en/language.types.array.php
Strings containing valid integers will be cast to the integer type. E.g. the key "8" will actually be stored under 8. On the other hand "08" will not be cast, as it isn't a valid decimal integer.
Edited after comment
Q4. I think OP's question is essentially why the second and the forth behave differently:
php > var_dump("00" === 0);bool(false)php > var_dump(00 === 0);bool(true)php > var_dump("08" === 8);bool(false)php > var_dump(08 === 8);bool(false)
I have no answer yet.