PHP Build a Basic PHP Website Listing and Sorting Inventory Items Review Basics

Cliff Jackson
Cliff Jackson
2,886 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
8,608 Points

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

Bill Dowd
Bill Dowd
7,680 Points

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

5 Answers

Yohan Park
Yohan Park
7,145 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.

Spenser Hale
Spenser Hale
18,327 Points

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,886 Points

Hi Chung that still does not work

Cliff Jackson
Cliff Jackson
2,886 Points

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

Cliff Jackson
Cliff Jackson
2,886 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 .";