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
Pavel Palancica
6,535 PointsCan't pass PHP code challenge
Hey Randy,
I can't pass the last part of the code challenge on this page:
Here is what I have so far:
<?php $flavor = "banana"; echo "<p>Your favorite flavor of ice cream is "; echo $flavor; echo ".</p>";
if ($flavor == "cookie dough.") {
echo "<p>Randy's favorite flavor is cookie dough, also!</p>";
}
?>
It's confusing to me, as anywhere I try to change the $flavor variable value, it gives me errors.
Please help.
Thanks in advance
5 Answers
samiff
31,206 PointsHey Pavel, the last task 4/4 wants you to change your $flavor variable declared on line 2 to 'cookie dough' to make sure that your conditional works and that "Randy's favorite flavor is cookie dough, also!" is displayed.
So you'd change $flavor = 'banana'; to $flavor = 'cookie dough'; which should mean that you'd enter inside the conditional. Let me know if it works!
samiff
31,206 PointsAlso just noticed, your pasted code here has your if statement comparing to "cookie dough." could that period be tripping you up?
Pavel Palancica
6,535 PointsThanks Sam!
It was "cookie dough." in the requirement, and I've copied it exactly, just to be on the safe side. Now it works ok :)
samiff
31,206 PointsGreat to hear Pavel. Hope you have fun with the rest of the lessons, I really enjoyed them
Nelson Diaz
1,291 PointsHello, I am stuck on this one as well, I tried the above solutions and still get errors. I have began a post asking for help.