Keys Are Integers Whenever Possible

../_images/keys_are_integers.png

Array keys are only strings or integers: the later has priority. So, when storing a string that can be converted to an integer, PHP does the conversion automatically.

In the case displayed, the keys are French zip codes, which might start with a leading 0. But PHP converts it into integer, and drops that leading 0. The value is still correctly indexed, but now, the string representation has changed.

See Also

PHP Features