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 trialBryan Haire
2,971 Pointsarray and control structure quiz
when i add yellow it works but when i do the same for black it doesnt. it says to add blact to the end. what am i missing?
<?php
$colors = array("Red","Green","Blue");
//add modifications below this line
$colors = array_values($colors);
$colors[0] = 'Yellow';
//$colors[4] = 'Black';
1 Answer
Steven Parker
231,198 PointsThe challenge asks you to "use a function to add "Yellow" to the beginning of the array".
Your assignment not only does not use a function, but it replaces the first color instead of adding a new one.
They didn't actually say how to add the other color, so you can actually get away with the assignment on that one sice it doesn't overwrite anything.