3 ms·
> * In PHP I've never accidentally combined 2 + 0.3 into 20.3 But PHP thankfully combines `md5("PHP") + 1` into 3. Sounds legit. I think Slack's own anecdote
by lifthrasiir 7y ago
> * In PHP I've never accidentally combined 2 + 0.3 into 20.3
But PHP thankfully combines `md5("PHP") + 1` into 3. Sounds legit.
I think Slack's own anecdote [1] is a better characterization of PHP nowadays. Hint: they don't disagree that PHP was (and to the lesser extent, still is) a terrible language.
[1] https://slack.engineering/taking-php-seriously-cf7a60065329 https://slack.engineering/taking-php-seriously-cf7a60065329
- ma2rten 7y agoCould someone please explain both the 2 + 0.3 and md5("PHP") + 1 thing?
- adimitrov 7y agoAutocasting. Autocasting was a cool and newbie friendly idea in principle. It just turned out to cause such horrible bugs in real code that no sane person would still argue its merits. It also leads to stupid notions of thruthiness (google Gary Bernhard's WAT talk) and bad junior dev behavior. I've seen a popularish PHP framework document the return value of a function al boolean, but the actual return value was the string "0". It wasn't even a by prduct of the implementation. They just explicitly used return "0" for no good reason.