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

Variable and Conditionals code challenge

Hi,

I'm stuck at task 4 in the code challenge. I change the variable on line 2 to "cookie dough" and I'm still getting an error that this is incorrect. My code is below. I can't figure out where I'm going wrong with this. It seems simple enough; just change the variable, but it doesn't work. I do get the desired result though. Both lines are echoed out as such:

Your favorite flavor of ice cream is cookie dough. Randy's favorite flavor is cookie dough, also!

<?php
$flavor = "cookie dough";
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>";}

?>

3 Answers

I ended up going back and starting all over and this time I had no issues. I still don't see what I did differently.

Christopher Crowd
Christopher Crowd
3,333 Points

Once in awhile the code challenges will bug out and not work correctly. I have issues once and awhile as well so usually i just refresh the page.

Good to know Christopher. Thanks.