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

Eitay Zilbershmidet
Eitay Zilbershmidet
3,942 Points

You should have my favorite flavor of ice cream in a variable named $flavor, and now it's time to display it to the scre

Hello,

I have no idea what's wrong.... The preview looks good and right but I keep get errors all time.

output.php
<?php
include ("flavor.php");
$flavor = get_flavor();
echo "Randy's favorite flavor of ice cream is ".$flavor.".";

?>

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,858 Points

Hey Eitay,

Your code is correct, but (for some reason) you changed the name in the echo statement from "Hal's" to "Randy's". This is what is giving you the error. The code checker compares your code to a very specific value, so if you change a value that you weren't instructed to, it will throw an error. Just change that name back and you will be good to go.

Also, just a tip. While it isn't necessary, it is good practice to leave spaces around the concatenating periods. This just helps with code readability. Syntactically, both are correct... it's just more common to have spacing.

eg. Instead of

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

Have

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

Keep Coding! :dizzy:

Eitay Zilbershmidet
Eitay Zilbershmidet
3,942 Points

Thank you Jason That was stupid error :)