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
Brittany Castle
3,362 PointsVariables and Conditionals 4 of 4
I am struggled with Variables and Conditionals 4 of 4 Challenge Tasks. Please help me to understand what wrong with this php.
<code>
<?php $flavor = "vanilla"; echo "<p>Your favorite flavor of ice cream is "; echo $flavor; echo ".</p>"; ?> <?php if ($flavor == "cookie dough") { echo "<p>Randy's favorite flavor is cookie dough, also!</p>"; }
?>
</code>
2 Answers
J.T. Gralka
20,126 PointsQuestion 4 asks you to do the following:
Change the value in the flavor variable to cookie dough. Preview the code and make sure the message appears.
In the code you provided, it looks as if you've used tow <?php ... ?> tags; whereas you can get away with using just one. Also, remember that the question is asking you to change the value of $flavor to "cookie dough". It doesn't look like you've done that; your $flavor variable still has a value of "vanilla".
Change the variable's value and see if that fixes anything. Let me know if you're still struggling with this question.
Best of luck!
J.T.
Brittany Castle
3,362 PointsOops! Thank you for noticing that. It is really simple question.