PHP variable interpolation vs concatenation [duplicate]

Whatever works best for you works…
But if you want to go for speed use this:

echo 'Welcome ', $name, '!';

The single quotes tell PHP that no interpretation is needed, and the comma tells PHP to just echo the string, no concatenation needed.

Leave a Comment