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


On PHP Basic challenge number 7, the code: eco $colors[1] is not being accepted, l can not progress

The question wants me to echo the second value in an array of three color values


........ echo colors[1] is not being accepted

3 Answers

Kevin D
Kevin D
8,646 Points

Not sure why it isn't working for you, I've done the same thing as you and got to pass. Maybe try copying and pasting this code and see if anything happens:


$integer_one = 1;
$integer_two = 2;
$golden = 1.618;
$bool = true;
$colors = ['red','blue','green'];

echo $colors[1];


thanks, l think l had added a (var_dump ) and that may have been the cause for failure to read.

It's seem you write eco instead of echo :)

sorry its actually a mistake on typing in the question, its refusing: echo $colors[1]

I was in the same boat and could not progress using "echo $colors[1];". I deleted the var_dump and it passed just fine.