How to concat string in PHP [duplicate]
I want to do like this:
$string = "";
$string += "lol"; //maybe =+ > tried but both not working
But it isn't working, anyone suggestions? Google isn't making my life easy (cant search characters like = or +)
In PHP, string concatenation is done with the .
operator:
$string .= 'lol';
+
is for addition.
$str = "";
while(...){
$str .= "lol.";
}
Replace the ellipses with your loop condition, (+=) is an addition assignment operator that adds the value of the right operand to a variable and assigns the result to the variable.
精彩评论