3 ms·
It is ok. That's how the language is designed so that arrays cover both hash-map use cases and traditional numerically indexed array use cases. The behavior is
by joesmo 12y ago
It is ok. That's how the language is designed so that arrays cover both hash-map use cases and traditional numerically indexed array use cases. The behavior is well documented and in this specific example, using a == instead of a === would cause the desired result. The poster of that comment should RTFM.
- imakesnowflakes 12y ago>The poster of that comment should RTFM... I am not sure I should go read the manual before setting a string key in an array to make sure that the specific string does not falls under some kind of special treatment. When normal people see that they can set string keys on something, they would assume that it work for all strings regardless of their content. And regarding PHP manual, it does not even have fundamental stuff right. This comment is from an ex php core developer. http://www.reddit.com/r/lolphp/comments/2md8c0/new_safe_casting_function_rfc_casting_10_to/cm3dpdj http://www.reddit.com/r/lolphp/comments/2md8c0/new_safe_cast... >using a == instead of a === would cause the desired result Except using == will result in a hundred other weird behaviors that have caused numerous many bugs and security vulnerabilities, that every one uses === with out exception..