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

PHP Build a Simple PHP Application Integrating with PayPal Array Keys

Cassandra James
Cassandra James
7,561 Points

array code challenge 2 of 2

this is the goal: modify the code inside the foreach loop to display the $isbn in parentheses. After the title, add a space, an opening parenthesis, the ISBN, and a closing parenthesis.

Here is my code on line 17: <li><?php echo $book ."(".$isbn.")"; ?></li>

I realize I am supposed to use concatenation to create the space but do not know

3 Answers

Hi Cassandra - You can either add the space just before the first parenthesis like this:

<?php echo $book . " (" . $isbn . ")"; ?>

Or you can add a space with concatenation by just putting a space inside of quotes like this:

<?php echo $book . " " . "(" . $isbn . ")"; ?>
Cassandra James
Cassandra James
7,561 Points

. " " . "(" . $isbn . ")";

Hi Jennifer,

I was working on it so long I guess I am half blind, I could SWEAR I entered the code above and got an error BUT you are right, I entered it now and it worked! THank you so much!!!

No worries, I do that all of the time. Sometimes you just need a fresh set of eyes to look at it :-)