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

Cliff Jackson
Cliff Jackson
2,887 Points

Just on the point of giving up??

Just can't do anything since taking a break from PHP, nothing has stuck and can't even get this to output, anyone help?

output.php
<?php
include ("flavor.php");
echo "Hal's favorite flavor of ice cream is . $flavor .".;
$flavor = get_flavor();
?>
Pontus Bolmér
Pontus Bolmér
12,471 Points

Remove the ( ) at your include, it should only be include "flavour.php";

Bill Dowd
Bill Dowd
7,681 Points

You have to populate the variable, $flavor before you can echo it.

5 Answers

Yohan Park
Yohan Park
7,148 Points

For includes you want to take out the parenthesis: include 'flavor.php'; For the echo statement, you want to move the second " after is: echo "Hal's favorite flavor of icecream is" . $flavor; As for the third line, I think you'd want to put that before the echo statement. But I'm unsure about that.

Hey Cliff

Jennifer already resolved your question here on this second thread you opened. It is best not to open multiple threads. Additional now that your question has been resolved, it would help the community if your close this question by selecting a best answer.

Thanks

Chung Kang
Chung Kang
7,325 Points

Hi Cliff, it looks like you have a syntax error at the echo statement. The double quote should end after the word "is" and you have a trailing "." at the end right before the semi-colon.

Another way is to enclose the whole string in double quotes and PHP will output it automatically without having to concat them together:

$test = "hello";
echo "Cool $test";
Cliff Jackson
Cliff Jackson
2,887 Points

Hi Chung that still does not work

Cliff Jackson
Cliff Jackson
2,887 Points

The problem is not the include, i cant get the concatenation to work in the echo statement.

Cliff Jackson
Cliff Jackson
2,887 Points

Bummer: syntax error, unexpected ';' in output.php on line 3

Remove last dont in the 3rd line, right before ';'. echo "Hal's favorite flavor of ice cream is . $flavor .".; --> echo "Hal's favorite flavor of ice cream is . $flavor .";