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 trialBappy Golder
13,449 PointsWhy are we using a string version of the code?
In the array_walk function we are using a string version of the function as a parameter. Why are we doing that?
array_walk($names, 'print_info');
1 Answer
Roy Penrod
19,810 PointsWe're using the name of the callback function as a string because that's what the PHP developers decided we should use. If you look at the examples in the documentation, you can see them showing you how to use the function.
Bappy Golder
13,449 PointsBappy Golder
13,449 PointsCheers Roy, now I'm wondering why they decided that :)
Roy Penrod
19,810 PointsRoy Penrod
19,810 PointsNow you're thinking like a programmer. ;-)