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 trialCliff Jackson
2,887 PointsJust 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?
<?php
include ("flavor.php");
echo "Hal's favorite flavor of ice cream is . $flavor .".;
$flavor = get_flavor();
?>
Bill Dowd
7,681 PointsYou have to populate the variable, $flavor before you can echo it.
5 Answers
Yohan Park
7,148 PointsFor 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
20,915 PointsChung Kang
7,325 PointsHi 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
2,887 PointsHi Chung that still does not work
Cliff Jackson
2,887 PointsThe problem is not the include, i cant get the concatenation to work in the echo statement.
Cliff Jackson
2,887 PointsBummer: syntax error, unexpected ';' in output.php on line 3
tomislavgelo
3,744 PointsRemove 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 .";
Pontus Bolmér
12,471 PointsPontus Bolmér
12,471 PointsRemove the ( ) at your include, it should only be include "flavour.php";