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

Pablo Grippo
Pablo Grippo
25,765 Points

I have a problem with the Code Challenge in Array Keys

Hi, everybody, I am in the Building a simple PHP application > Integrating with PayPal > Array Keys section and I can't continue on the challenge.

When I try to do the exercise, it says me this: Bummer! Something's not quite right: you are loading book titles into a variable named $isbn. (Here's a clue: you should be using a double arrow.)

What is refer when it say 'double arrow' to? Please, help me!!

I appreciate any response from anybody here, Thanks you so much!

4 Answers

Kevin Korte
Kevin Korte
28,148 Points

If my memory is right it wants this: =>

An equal sign = and a greater than sign >

Try that

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

When we first learned the foreach loop, we just loaded values from the array into a working variable:

foreach($array as $values) {

Now, we want to change the code a little to load the values and the keys into working variables. We will need that double arrow operator, which is exactly what @Kevin says it is:

=>

Does that help?

Pablo Grippo
Pablo Grippo
25,765 Points

I have done this:

<?php foreach($books as $book => $isbn) { ?> <li><?php echo $book; ?></li> <?php } ?>

But it throws me error. What am I doing bad? Please help me!

Thanks!

Pablo Grippo
Pablo Grippo
25,765 Points

PROBLEM SOLVED!

Thank you Kevin Korte and Randy Hoyt for your response and help! I appreciate it a lot!!

I made these and everything was ok:

<pre> <?php foreach($books as $isbn => $book) { ?> <li><?php echo $book ." (". $isbn. ")"; ?></li> <?php } ?> </pre>

Ann Kwilinski
Ann Kwilinski
3,169 Points

Thank you I was stuck on this too!