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.

PHP Object-Oriented PHP Basics Building the Recipe Accessing Arrays

Some unclear or incorrect instructions in challenge 4/5 of Accessing Arrays

In task 4 you are asked:

Time to add a NEW associative array named $favorite_colors. The keys will be, in order, the following: 'mike', 'jane', 'chris' with values for each. Thos values are 'green', 'blue', 'red'

To complete the exercise you also have to var_dump() the resulting array but this is not stated in the question.

In task 5 you are asked:

Now using the $favorite_colors array, echo mike's favorite color.

Going by the code of the previous exercise which we build on mike's favorite color would be green. The result of the following code:

<?php
echo $favorite_colors['mike']; // prints green

To complete the task however you have to print the favorite color blue which belongs to jane.

<?php
echo $favorite_colors['jane']; // prints blue

For the sake of thoroughness I'm running Google Chrome with the following version number and extensions:

  • Version 70.0.3538.77 (Official Build) (64-bit)
  • uBlock Origin (v.1.17.0)

0/