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 trialSamantha Smith
1,668 PointsError when printing second value of $colors array.
I'm asked to echo the second value of $colors array (blue), but I get an Bummer error. Tested it on my own and it works fine. I even tried changing the number just to see, but no luck. Maybe I'm not understanding the question properly.
<?php
//Place your code below this comment
$integer_one =1;
$integer_two=2;
$golden=1.618;
$bool=TRUE;
var_dump($bool);
$colors = array('red','blue','green');
echo $colors[1];
?>
1 Answer
Chris Shaw
26,676 PointsHi Samantha,
You have more code than what you need for task 6, the challenge never asks you to place a var_dump
statement in between $bool
and $colors
which is why it's giving you a bummer error. Simply remove it and the challenge will pass.
<?php
//Place your code below this comment
$integer_one = 1;
$integer_two = 2;
$golden = 1.618;
$bool = true;
$colors = array('red', 'blue', 'green');
echo $colors[1];
?>
Happy coding!
Samantha Smith
1,668 PointsSamantha Smith
1,668 PointsChris. you. are. awesome! That worked, I guess I misunderstood what the $bool question was asking me for, and the script they're using to check for the right answer for that question isn't checking for extra unnecessary code.