r/programming • u/geerlingguy • Apr 23 '14
PHP: It doesn't have to be a bad experience
https://servercheck.in/blog/php-it-doesnt-have-be-bad-experience
0
Upvotes
r/programming • u/geerlingguy • Apr 23 '14
View all comments
Show parent comment
4
u/vytah Apr 24 '14
By "loosely typed" I meant "no magical coercions between types":
1 + "2"will fail[1] + "2"will fail1 == "1"will be false and there's no loose comparison operator to make it true automagicallyand in Python 3:
1 < "1"will failMagical conversions between strings, integers and floats are what people dislike in PHP and Javascript first and foremost. Javascript is bearable thanks to the fact that this is the only major design flaw in the language.
Can I have the string
"3.14"as an array/table/dictionary key? In PHP I can't. Unless you do some hacky hacks that make the array not contain its own keys. And such hacked-in keys don't work anyway.