Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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 :-)