This question already has an answer here:
while trying this, I get error. is there a way to do it? I can assign multiple strings to a single variable but I don't know why it doesn't work with another variables.
$var1 = "Hello";
$var2 = "There";
$var3 = $var1, $var2;
echo $var3, "<br />";
</div>
Use concat like this:
(Or maybe you just made a typo because ,
is directly to the left of .
)
$var1 = "Hello";
$var2 = "There";
$var3 = $var1 . " " . $var2;
echo $var3 . "<br />";
See for further reference: