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 Basic PHP Website (2018) Building a Media Library in PHP Variables and Conditionals

what is the answer

of this problem

index.php
build a basic php website challenge 3 of 3

1 Answer

Kieran Barker
Kieran Barker
15,004 Points

Hi, Abdullah!

Like the challenge says, the last sentence...

Hal's favorite flavor is cookie dough, also!

...Only makes sense if your $flavor variable contains the same string, cookie dough.

So, you need to say:

If my $flavor variable contains the string cookie dough, then print out <p>Hal's favorite flavor is cookie dough, also!</p>.

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

thanks for your quick response; already done the problem.