Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,660 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.