Why a full stop, “.” and not a plus symbol, “+”, for string concatenation in PHP?

前端 未结 12 1610
暖寄归人
暖寄归人 2020-12-09 01:54

Why did the designers of PHP decide to use a full stop / period / \".\" as the string concatenation operator rather than the more usual plus symbol \"+\" ?

Is there

12条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-09 02:04

    This doesn't answer the question, just wanted to share something.

    From PHP Manual: String Operators, someone posted this which I find rather interesting. Notice how the space plays a part in the output.

    Excerpt:
    If you attempt to add numbers with a concatenation operator, your result will be the result of those numbers as strings.

    
    

提交回复
热议问题