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

PHP Programming challenge help

Hello, I am stuck on this PHP programming challenge: Change the value in the flavor variable to cookie dough. Preview the code and make sure the message appears.

Here is the first code prior to the variable change:

<?php $flavor = 'vanilla';

echo "<p>Your favorite flavor of ice cream is ",$flavor;

echo ".</p>"; if ($flavor == 'cookie dough') {echo "<p>Randy's favorite flavor is ", $flavor, " also!"; }

?>

When I change the variable from $flavor = 'vanilla'; to $flavor = 'cookie dough';

I receive "Oops it looks like task 3 is no longer passing"

Thanks in advance!

7 Answers

Nikolaos Papathanassopoulos
Nikolaos Papathanassopoulos
10,322 Points

Can you post the link to the challenge pls?

If i remember it correctly it was "cookie dough." so you're missing a period. But post the link anyway pls.

~ Nikos

Nikolaos Papathanassopoulos
Nikolaos Papathanassopoulos
10,322 Points

Ok this was a little tricky:

The last part of the challenge asks you to change the flavor to 'cookie dough'

<?php
$flavor ="cookie dough";
?>

make sure it appears: change it in the if statement also:

if ($flavor = "cookie dough") {//than do something}...
                    !without a period / '.'

i normally dont want to just post the solution, but when i did this challenge i also thought that '.' is wanted or a typo. also you understood it obviously.

~ Nikos.

Now I am getting : "Bummer! be sure to add a conditional to hide the message" <?php $flavor = "vanilla";

echo "<p>Your favorite flavor of ice cream is ",$flavor;

echo ".</p>"; if ($flavor == "cookie dough") {echo "<p>Randy's favorite flavor is ", $flavor, " also!"; }

?>

I make my change in the variable to cookie dough like it asks:

<?php $flavor = "cookie dough";

echo "<p>Your favorite flavor of ice cream is ",$flavor;

echo ".</p>"; if ($flavor == "cookie dough") {echo "<p>Randy's favorite flavor is ", $flavor, " also!"; }

?>

Then the error I get is: "Oops! It looks like Task 3 is no longer passing."

GOT IT!!! I just went back to the beginning and redid the whole challenge, not sure why the change did not take the first time. Thank you for your help! Have a great day!

how to hide massage? any idea

I got same problem with task 3.