Automattic / wp-cldr

Use CLDR localization data in WordPress
GNU General Public License v2.0
24 stars 6 forks source link

Some region codes are integers, some are strings #18

Closed stuwest closed 9 years ago

stuwest commented 9 years ago

In territory array keys, region codes with leading zeros are parsed as strings but those without leading zeros are converted to integers:

screen shot 2015-03-02 at 8 41 49 am

stuwest commented 9 years ago

Turns out this is a "feature" of PHP's loose typing see the PHP manual on key casts that happen in arrays:

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.