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

Kitisak Huaynuy
Kitisak Huaynuy
9,120 Points

I don't pass the test.

I don't pass the test. I don't understand, somebody help me please?


Challenge task 4 of 4 Change the value in the flavor variable to cookie dough. Preview the code and make sure the message appears.


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

            ```

For ease of readability...

<?php

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

if ( $flavor =="Chocolate" ) {
    echo "cookie dough";
}

?>

If you want to know how I did that, check out the Markdown cheatsheet.

Kitisak Huaynuy
Kitisak Huaynuy
9,120 Points

Thank you for you instructions.

6 Answers

Sean T. Unwin
Sean T. Unwin
28,690 Points

Hi, Kitisak Huaynuy. You added another if statement. You only need to change the value of the variable.

$flavor = "cookie dough";

Also, task 3 has you add an if statement to check whether $flavor is equal to "cookie dough"` and you have "vanilla"

Basically, you want to display the second sentence ("Randy's favorite flavor is cookie dough, also!") only if your favorite flavor is cookie dough. Remember, $flavor is your favorite flavor.

So, if your favorite $flavor is equal to "cookie dough", then it should echo out that Randy's favorite flavor is cookie dough, also!.

du får det nästa gång

du får det nästa gång

du får det nästa gång

Kitisak Huaynuy
Kitisak Huaynuy
9,120 Points

thank you everybody, I will follow the recommend.