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 Basic PHP Website (2018) Listing and Sorting Inventory Items Array Keys

Daniel Harrison
Daniel Harrison
2,944 Points

I am totally lost

Cannot figure out Array Keys 2 part Challenge in the Build a Basic PHP series. Any help would be appreciated

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

I wish I knew what you'd tried that was failing. Because you passed the first step, my gut instinct is to say that maybe you missed the part in the instructions where it said to add open and closed parentheses around the ISBN number. But I really have no idea. Here is the echo line that you need:

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

Hope this helps! :sparkles:

Daniel Harrison
Daniel Harrison
2,944 Points

Thank you for you prompt reply.

But i did not pass the first step!! Where it asks to modify the foreach .

that is what has me totally confused.

thanks again

Dan

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Daniel Harrison ah ha! Sorry, I misunderstood. This is the first line you need then:

<?php foreach($books as $isbn => $book) { ?>

:sparkles: