Re:A look at modern PHP
by out_of_protocol on Tuesday May 05, 2020 @12:59PM
(#23082152)
Either choice doesn't really look like the sane language anymore
[ Parent
| on HN ]
Re:A look at modern PHP
by mywittyname on Tuesday May 05, 2020 @03:19PM
(#23083746)
When you have dynamically typed languages, whether to coerce or not is a design decision with usability trade-offs. Javascript exhibits pretty similar behavior with switch statements for exactly the same reason: it also has two types of equality comparisons.
Also, PHP allows you to add explicit type casting to case statements. e.g.,
case (string) 1: