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

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/