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
14,976 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.