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

Cant seem to call the right function in this task

Bummer! It doesn't look like you've called the get_flavor function. Please check your code and try again - this is the error message I receive :) Can anyone help me.

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

?>
Jesse Rushlow
Jesse Rushlow
Courses Plus Student 2,828 Points

It's been a while since I've used php but it looks like you need to separate your variable $flavor from the string in your echo statement.

I.e. echo "Heres my string and my " . $var;

1 Answer

Hi Jonas,

You have a couple of issues.

Firstly, you are not calling the function get_flavor correctly. Calling a function in PHP requires you to enter the name of the function followed by parentheses. i.e. To call the get_flavor function you would write get_flavor(), and without the quotation marks surrounding them as you currently have

The second part is as Jesse mentions above, you need to concatenate the $flavor variable outside of the string. Don't forget to also concatenate the period at the end of the sentence otherwise it won't pass. i.e. something like

"This is my string " . $variable . ".";

Hope that helps. Don :-)