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 trialCarl Sergile
16,570 PointsHey can't seem to figure out this question....
Getting the Treehouse oops box everytime I hit check work. I did the whole thing 3 times already.
<?php
$flavor = "vanilla";
if ($flavor == "cookie dough") {
echo "Hal's favorite flavor is cookie dough, also!";
} else {
echo "Your favorite flavor of ice cream is $flavor";
}
echo $flavor();
?>
1 Answer
Damien Watson
27,419 PointsHey Carl,
I noticed you put '()' at the end of the last line, it will think that '$flavor' is a function call.
<?php
$flavor = "vanilla";
if ($flavor == "cookie dough") {
echo "Hal's favorite flavor is cookie dough, also!";
} else {
echo "Your favorite flavor of ice cream is $flavor";
}
echo $flavor;
?>
Damien Watson
27,419 PointsDamien Watson
27,419 PointsInitially I thought it was the 'else' as well, as the question says to return nothing on a match, but it seems to work either way.
Carl Sergile
16,570 PointsCarl Sergile
16,570 PointsNice thanks man! Was losing my mind for a min. Posted another php related question on arrays...