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 PHP Functions PHP Internal Functions PHP Array Functions

Why 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
Roy Penrod
19,810 Points

We'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.

Cheers Roy, now I'm wondering why they decided that :)

Roy Penrod
Roy Penrod
19,810 Points

Now you're thinking like a programmer. ;-)