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 trialChris Craigman
13,659 PointsI'm adding things to the array but its telling me I'm not.
I'm pretty sure I'm using the right code for adding objects to both the front and back of the array but when I tried to submit it, it proclaims that I ahve not added anything to the array
<?php
$colors = array("Red","Green","Blue");
//add modifications below this line
array_unshift($color,'Yellow');
array_push($color,'Black');
?>
1 Answer
Steven Parker
231,261 PointsI don't think changing the quotes did anything to help pass the challenge.
While you were making that change, you probably also fixed the spelling of "$color" (as shown in this code) to "$colors" (which is the correct name).
James Ackerman
14,099 PointsJames Ackerman
14,099 PointsI was able to complete the challenge using double quotes on Yellow and Black. Not sure why, but I'm guessing it needs to follow the same format as the array you're modifying.
Perhaps someone with a bit more PHP knowledge can explain in more detail.