Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
Yaxin Yuan
11,191 PointsThere is a line of code I do not quite understand, please help!
echo '<img src="' . $product["img"] . '" alt="' . $product["name"] . '">';
- Why single quotation inside double quotation?
- Why concatenation?
Thank you!
2 Answers
![Saad Lulu](https://uploads.teamtreehouse.com/production/profile-photos/2557322/micro_lulu.jpeg)
Saad Lulu
6,821 PointsWe usually use single quotes for string that will not print out a value of a variable, and double quotes will render the value of a variable.
<?php
$string = 'hello world';
echo 'I said $string'; // I said $string
echo "I said $string" // I said hello world
?>
if you want to use single quotes but also get a value of a variable you can use concatination like so,
<?php
$string = 'Hello world'
echo 'I said' . $string; // I said Hello world
?>
![vickiecomrie](https://uploads.teamtreehouse.com/production/profile-photos/1559812/micro_vick.jpg)
vickiecomrie
3,248 PointsYou can also use '' and "" interchangeably-- for example
<?php $string="vick"; echo 'I said $string'; echo "I said $string"; ?>
I said $stringI said vick
Yaxin Yuan
11,191 PointsYaxin Yuan
11,191 Pointssry, just found that I did not type the code properly, and it wasn't displayed.