Arithmetic operation within string concatenation without parenthesis causes strange result

后端 未结 3 603
星月不相逢
星月不相逢 2021-01-13 17:34

Consider the following line of code:


The output of that is 3, which is the expec

3条回答
  •  余生分开走
    2021-01-13 18:00

    . and - have the same precedence, so PHP is reinterpreting '10 - 7 = 10' as a number, giving 10, and subtracting 7 gives 3.

提交回复
热议问题