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.

Johnathon Southworth
3,417 PointsWhat is happening
This is correct. So why is it not working?
<?php
//Place your code below this comment
$colors = ["red", "green", "blue"];
echo $colors[1];
$favorite_colors = ["mike" => "green",
"jane" => "blue",
"chris" => "red"];
echo $favorite_colors["mike"];
?>
1 Answer

Jennifer Nordell
Treehouse TeacherHi there! You're doing great and there are no syntax errors. To be honest, I'm not sure exactly how this code passed the first few steps, but what's happening here is that your original $colors array contains the colors in the incorrect order which is making the final output greengreen
instead of bluegreen
which is clearly what they're checking for.
So this line:
$colors = ["red", "green", "blue"];
Should look like this:
$colors = ["red", "blue", "green"];
Note the reversal of blue and green between the two arrays. When I make that change, your code passes! Good luck!
Johnathon Southworth
3,417 PointsJohnathon Southworth
3,417 PointsGoodness! Thank you! How silly. I was very flustered. Thanks for the timely response!