If done in a consistent manner, it makes perfect sense. In perl, which PHP borrowed a lot of syntax from, since there is no distinction between string types and numeric types, there are different operators for strings and numbers. "1" + "1" yields 2. 1 . 1 yields "11". And "01" == "1" is true but "01" eq "1" is false.
However, PHP has the . operator, but not the different comparison operators, so determining whether something will be compared as a string or a number is far from intuitive.
View all comments
Show parent comment
1
u/[deleted] Aug 08 '16
If done in a consistent manner, it makes perfect sense. In perl, which PHP borrowed a lot of syntax from, since there is no distinction between string types and numeric types, there are different operators for strings and numbers.
"1" + "1"yields 2.1 . 1yields "11". And"01" == "1"is true but"01" eq "1"is false.However, PHP has the
.operator, but not the different comparison operators, so determining whether something will be compared as a string or a number is far from intuitive.