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 trialThijs Berkers
23,038 PointsCreate an empty array named $colors
I need to create an array with the name $colors.
$colors = array(); doesnt do the trick.
Someone can help me out?
<?php
//Place your code below this comment
$integer_one = 1;
$integer_two = 2;
$golden = 1.618;
$bool(true);
$colors = array();
?>
2 Answers
mikes02
Courses Plus Student 16,968 PointsNiclas, that answer will not complete the challenge.
Thijs, the error seems to be related to your $bool variable, the challenge is asking you to create a $bool variable that evaluates to true, and you are using $bool(true) which is incorrect. The correct method for creating a $bool variable that evaluates to true is:
<?php
//Place your code below this comment
$integer_one = 1;
$integer_two = 2;
$golden = 1.618;
$bool = true;
$colors = array();
?>
Niclas Valentiner
8,947 PointsThere are multiple ways to create an array in PHP but if all you need is an array with the name of colors:
$colors[];
It's easier to create an array with values though, just comma separate them inside them inside the square brackets.
Niclas Valentiner
8,947 PointsNiclas Valentiner
8,947 PointsDidn't check the challenge itself, I tend to assume that people provide their problem and any necessary code and work on that.
I should have noticed the bool var though, that was a hefty brain fart on my part.
mikes02
Courses Plus Student 16,968 Pointsmikes02
Courses Plus Student 16,968 PointsIt's OK Niclas, it happens to all of us :)