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 trialIoan Ionkov
Courses Plus Student 6,921 PointsPHP function issue on a task
Upon submitting my solution to this task, I get that the function is being pre-declared, when I am simply returning the value and assigning it to a variable. I will include my code bellow please advice further.
<?php
include "flavor.php";
function get_flavor(){
return $flavor;}
echo "Hal's favorite flavor of ice cream is ____.";
?>
1 Answer
Umesh Ravji
42,386 PointsHi Ioan, the get_flavor
function is already written for us in flavor.php
, just have to use it :)
You have to create the $flavor
variable, and assign to it whatever is returned from calling get_flavor
.
<?php
include "flavor.php";
$flavor = get_flavor();