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 Basic PHP Website (2018) Listing and Sorting Inventory Items Review Basics

Joshua Paulson
Joshua Paulson
37,085 Points

Having trouble with this code challenge. It continues to tell me that task one is no longer passing but it should work.

Please explain what I'm doing wrong.. Looking for more than just an answer.

Thank you, my excellent forum friends!

output.php
<?php

include("flavor.php");

$flavor = get_flavor();

echo "Hal's favorite flavor of ice cream is "$flavor";

?>
Daniel Gauthier
Daniel Gauthier
15,000 Points

Hey Joshua,

Try removing the quotes around the variable in the echo statement :D

As it stands, you have the opening and closing double quotes for the echo statement, then you have an opening quote around the variable with no associated closing double quote. The variable won't need to be in its own set of quotes here.

Good luck!

2 Answers

You are really close, You got the first two questions correct. The issue you are having is you are not concatenating the variable $flavor properly in the echo statement. you need to use the concatenation operator "." before and after each new element. And you forgot to add a period at the end of the echo statement.

Daniel Gauthier,

I totally agree, and yes it does work, but I think this is just style in this case, but I prefer the concatenation than just having the variable inside the string, for me it makes things easier to read and understand what is going on. That' s just me, and I think its just style. Good call on describing the different ways to complete the challenge.

Daniel Gauthier
Daniel Gauthier
15,000 Points

Hey Jacob,

Good call on the missing period.

I just wanted to add that the test will pass and work correctly without concatenation in this case also.

This is the code I used that passed:

<?php

include ("flavor.php");

$flavor = get_flavor();

echo "Hal's favorite flavor of ice cream is $flavor.";

?>