Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

James Barrett
13,253 PointsWhat is wrong with my code? Build a PHP website review
<?php include("flavor.php");
echo "Hal's favorite flavor of ice cream is" . $flavor . ".";
$flavor = get_flavor();
?>
<?php
include("flavor.php");
echo "Hal's favorite flavor of ice cream is" . $flavor . ".";
$flavor = get_flavor();
?>
3 Answers

Geovanie Alvarez
21,500 PointsYou have 2 problem: #1: the $flavor have to be before the echo statement, #2: in the echo you need a space between the "is" and the $flavor.
<?php
include("flavor.php");
$flavor = get_flavor(); // #1
echo "Hal's favorite flavor of ice cream is " . $flavor . "."; // #2
?>

rvandaalen
24,090 PointsYou're probably just missing a space after the fist part of the sentence. This worked for me:
<?php
include('flavor.php');
$flavor = get_flavor();
echo "Hal's favorite flavor of ice cream is " . $flavor . ".";
?>

michaelleonard4
7,013 Pointswhat no way this worked for you, you are doing it the other way around include shoud be first, then the declaration of the variable flavor, and then the echo statment!!

rvandaalen
24,090 PointsI just jumped into the challenge quickly and listed int in the order of the three challenges, but I agree that it seems weird and this is not the ideal way to display it here.
James Barrett
13,253 PointsJames Barrett
13,253 PointsGreat, thanks