On the face of it you're technically correct, and i've been bitten by numeric string key coercion in the past. But another way of thinking about it is that PHP's combined array/dict implementation is a perfectly valid set/dict, just over a subset of values where 2 and "2" are not really distinct. And clearly this was intentional given all the other parts of the language that treat types weakly.