How can I use the += operator in PHP for a string? [duplicate]
How can I use the += operator for a string in PHP?
Below is a Java example:
String str = "";
str += "some value";
str += "some more values";
The above example concatenates and assign all values to the str object.
How can I achieve this in PHP?
You are searching for .=:
$str = "";
$str .= "some value";
$str .= "some value";
$str .= "some more values";
Either:
$str = $str + "stuff";
Or:
$str .= "stuffsicles";
加载中,请稍侯......
精彩评论