Possible Duplicate:
curly braces in string
I still don’t know what it’s called. Like:
$name = 'xxx';
echo "This is a string {$name}";
What do you call that operation? Concatenating a variable using {} in to a string.
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is not concatenation ; this is variable interpolation ; see the Variable parsing section, in the PHP manual.
Basically, you can use any of the two following syntaxes :
Or :
And you’ll get the same result in both cases — except the second one allows for more complex expressions.
Concatenation would be something like this :
Where the content of the variable
$valueis concatenated to the string, using the concatenation operator..