Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to concat string in PHP [duplicate]

Tags:

loops

php

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 +)

like image 499
user657601 Avatar asked Sep 11 '25 07:09

user657601


1 Answers

In PHP, string concatenation is done with the . operator:

$string .= 'lol';

+ is for addition.

like image 181
Marc B Avatar answered Sep 12 '25 21:09

Marc B