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 Build a Simple PHP Application Creating the Menu and Footer Variables and Conditionals

Brian Platt
Brian Platt
5,009 Points

Not sure why my code isn't passing

Hey guys, why isn't this code passing? I'm sure I'm doing something obviously wrong Thanks! Brian

<?php $flavor= "vanilla"; if ($flavor == "vanilla"; echo "<p>Your favorite flavor of ice cream is "; echo "vanilla"; echo ".</p>"; echo "<p>Randy's favorite flavor is cookie dough, also!</p>";

?>

3 Answers

Hi,

You forgot the closing ) bracket for the condition. Also you need { } curly brackets to hold the statements it will do if the condition is true. Also should be no semicolon after vanilla.

<?php $flavor= "vanilla"; if ($flavor == "vanilla") { echo "Your favorite flavor of ice cream is "; echo "vanilla"; echo "."; echo "Randy's favorite flavor is cookie dough, also!"; }

Brian Platt
Brian Platt
5,009 Points

Thanks I knew that it was something obvious! Thanks again!

No problem, glad to help.