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

PHP Object-Oriented PHP Basics Building the Recipe Accessing Arrays

Alfredo Prince
Alfredo Prince
6,175 Points

How is this possible?

Bummer! the color red does not seem to be a value in your array

how is it not!?

index.php
<?php

//Place your code below this comment
$colors[] = array("red",
"blue",
"green"
);
?>

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! It's because it shouldn't have passed the first step (in my opinion). We use the square brackets to access a specific element in the array. You can see the php documenation here:

http://php.net/manual/en/language.types.array.php

Long story short: remove the square brackets after $colors :smiley:

Alfredo Prince
Alfredo Prince
6,175 Points

Duh!!!! Thank you!!! Now i know i'm ONLY partially retarded!