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
Robby White
11,369 PointsConditional Code Check
I pass the code check on step 1, 2 and 3, but when I get to 4 I get an error:
<?php
$flavor = "cookie dough";
echo "<p>Your favorite flavor of ice cream is ";
echo $flavor;
echo ".</p>";
if ($flavor == "cookie dough") {
echo "Randy's favorite flavor is cookie dough, also!";
}
?>
Not sure what I'm doing wrong. It displays correct in the test area.
3 Answers
Tuguldur B.
Courses Plus Student 3,099 PointsAlthough the semantics are right, it gets a little messed up when it gets validated by treehouse engine because of the missing <p> and </p>. Try writing the code without removing the <p> and </p> tags. I think that would solve it.
Randy Hoyt
Treehouse Guest TeacherYes, it looks like it's the missing paragraph tags that are causing the problem. Try this:
<?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>";
}
?>
Robby White
11,369 PointsAwesome. Thanks guys!