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

how do i do it

this is the message i am getting on this code challeng: " It looks like you called the right function but you aren't loading the return value into a variable with the name . Your code should look something like this: $variable = function_name()" am not getting what i should be doing here

output.php
<?php
 include 'flavor.php';
get_flavor([$flavor=null ]);
echo "Hal's favorite flavor of ice cream is ____.";

?>

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

The get_flavor function takes no arguments and returns a value ( in this case a string containing a flavor of ice cream). Take a look at what you need:

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

?>

Here we set up our flavor variable then tell it to go into the flavor.php file and run the get_flavor() function. We know that it will return a string containing an ice cream flavor, but have no idea which one. So it does that and returns the string which is now stored (appropriately enough) in our $flavor variable. Hope this helps!