What is the correct way to concatenate variables and string literals in PHP for output?
When concatenating variables and string literals in PHP for output, you can use the "." operator to combine them together. This allows you to create a single string that includes both the variable values and the static text. Make sure to enclose the entire expression in double quotes to ensure proper interpolation of variables within the string.
$name = "John";
$age = 30;
echo "Hello, " . $name . "! You are " . $age . " years old.";