Insert variable values in the middle of a string in PHP
PHP - concatenate or directly insert variables in string
echo "Welcome $names!";
PHP will interpret your code as if you were trying to use the
$names
variable -- which doesn't exist. - note that it will only work if you use "" not '' for your string.you'll need to use
{}
:echo "Welcome {$name}s!"