How can I use += operator in PHP for String [duplicate]
问题 This question already has answers here : How to combine two strings together in PHP? (17 answers) Closed 5 years ago . I am new to PHP. I need to know how to use += operator for string in PHP. Below is Java example: String str = ""; str += "some value"; str += "some more values"; the above example concatenates and assign all values to str object. Can somebody tell me how to achieve this in PHP? 回答1: You are searching for .=: $str = ""; $str .= "some value"; 回答2: $str .= "some value"; $str .=