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.

Adeline Itayi Chikurunhe
901 Pointsusing the $colors array how do i echo the second value
using the $colors array how do i echo the second value.
3 Answers

Henrique Voni
12,296 PointsHeyy!
You can use:
echo $colors[1];
Hope it helps!

Shaun Moore
6,301 PointsFor an array like that it goes:
$colors = array['
[0] => ['red'],
[1] => ['blue'],
[2] => ['green']
']

Daniel Baker
3,198 PointsI keep trying echo $colors[1]; and it keeps telling me that it is the wrong answer. I have tried every variation that I can think of and it still will not tell me that it is correct.
Adeline Itayi Chikurunhe
901 PointsAdeline Itayi Chikurunhe
901 Pointsthis is how i am doing it. <pre><?php $colors=array('red','blue','green') in echoing the second value i did this; echo $colors[0] and this is not working