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 trialZach Minot
6,182 PointsSeparating Concerns
This code creates an array of ice cream flavors and then displays them in an index.php file. However, we now also need the array of ice cream flavors in another file. Let's move the flavors array into a model file. First, in flavors.php, create a new function called get_all_flavors().
Tried everything, cannot get this to work. Anyone know the correct code for it?
3 Answers
Zach Minot
6,182 PointsThis is just asking for you to create a new, empty function in flavors.php. Remember the syntax of creating a new function is this:
function function_name (argument, if necessary) {code to be executed};
so, if I wanted to make a new, empty function named HelloWorld:
function HelloWorld(){};
Spencer Johnson
19,708 PointsZack, Post your solve. I am having trouble figuring it out.
Spencer Johnson
19,708 PointsThank you. I was putting an = sign after function that did not need to be there.
Zach Minot
6,182 PointsZach Minot
6,182 PointsNever mind solved it!