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

Someone help me please ;-;

The "flavor.php" include file contains a function named get_flavor. That function receives no arguments, and it returns a piece of text as its return value. Call that function and assign the return value to a variable named $flavor.

I need some help I keep failing and failing at this one! Someone know the solution?

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

2 Answers

Simon Coates
Simon Coates
28,694 Points

it seems to accept:

<?php
require('flavor.php');
$flavor = get_flavor();
//echo "Hal's favorite flavor of ice cream is $flavor."; //also works
echo "Hal's favorite flavor of ice cream is ".$flavor.".";
?>

(when you just want a solution, you can normally just enter the question into google and it should serve you up forum posts for other treehouse users who were stuck on the same thing.)

Luc de Brouwer
seal-mask
.a{fill-rule:evenodd;}techdegree
Luc de Brouwer
Full Stack JavaScript Techdegree Student 17,939 Points

As Simon said, you forgot to print out the values you put in the variable. You will probably get an output from the function if you echo it out as mentioned above