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 trialJolanta Dermody
Courses Plus Student 13,118 Pointsplease help
Next, letβs move the flavors array into that function. This task has two steps. (1) Move the code that creates the flavors array from index.php into the get_all_flavors() function in flavors.php. (2) Add code at the end of the function so that it returns the array of flavors back to whatever code calls it. i really stuck...
2 Answers
Myroslav Tkachenko
10,581 PointsYou need to move the code that initializes an array with flavors, then in second step you need to simply return that array with return
keyword:
function get_all_flavors() {
$flavors = array(
'flavor 1',
'flavor 2'
);
return $flavors;
}
Hope this will help.
Paolo Scamardella
24,828 PointsAlso, the 3rd step is to call get_all_flavors function, and since it returns an array, you have to assign it to the $flavors variable in the index.php file.