php string number concatenation messed up

前端 未结 5 1335
灰色年华
灰色年华 2020-12-07 01:13

I got some php code here:

 

which outputs 234,

but when I add a number 11 before \"

5条回答
  •  北海茫月
    2020-12-07 01:51

    The dot operator has the same precedence as + and -, which can yield unexpected results.

    That technically answers your question... if you want numbers to be treated as numbers during concatination just wrap them in parenthesis.

    
    

提交回复
热议问题