Welcome to the Treehouse Community
Looking to learn something new?
Concatenation of the working variables. Why?
Can someone explain why there needs to be concatenation on each side of the working variable? What purpose does it serve?
Why won't this work?
echo '<img src="'$product["img"]'" alt="'$product["name"]'"';
Just curious. Thanks!
Chris Shaw26,650 Points
Your current code is almost correct, after the opening single quote and before the ending single quote you need a period which tells the PHP compiler that you're joining two strings together, see the below.
NOTE: I've also added an ending closing bracket for the
echo '<img src="' . $product["img"] . '" alt="' . $product["name"] . '">';
Now your code should work without any issues.