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 PHP Basics (Retired) PHP Datatypes PHP Datatypes Challenge

Daniel Rowlands
PLUS
Daniel Rowlands
Courses Plus Student 4,438 Points

Now using the $colors array, echo the scond value... Why is my answer wrong?

I have followed all steps necessary to complete this, but am unable to finish.

2 Answers

Hi,

This should be answer echo $colors[1]; In PHP array index start with "0" not "1".So if you want to access second values inside array then you have to specify array index "1".

Daniel Rowlands
Daniel Rowlands
Courses Plus Student 4,438 Points

Unfortunately, that is what I previously had. It gave me this answer: "It looks like you are echoing the wrong thing, remember that arrays are 0 based..."

Grace Kelly
Grace Kelly
33,990 Points

Hi Daniel, could you please post your code so we can see what's up?? :)

Daniel Rowlands
Daniel Rowlands
Courses Plus Student 4,438 Points

Umm... I thought I had already, but anyways. I tried the same answer the day after and, it did work. It must have been my fault... Thank you anyways.