Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
pdimitar
· 6y ago · 0 comments
PHP silently transforming all string keys of a map to integers when they are all integer strings ("123", "456" etc.) is exactly one of the reasons I'll never choose a language that pulls the rug from below my feet and replaces it with parquet.
Comments
[–]
limomium
6y ago
If you bother to read the manual [1], it explicitly states that this happens. Almost at the top of the page. Hardly "silent".
[1]
https://www.php.net/manual/en/language.types.array.php
[–]
pdimitar
OP
6y ago
It's not reasonable to expect such gotchas. It might have been a 20px red bold text on top of php.net and it would still be very not okay.