News Feed
Jobs Feed
Sections




News Archive
Developer Tutorials Blog:
PHP array_walk() Run an array through a function
April 23, 2008 @ 08:47:09

The Developer Tutorials blog has a quick example of how to use the array_walk function to maneuver through the array of your choosing and applying a callback method to each of its elements.

It's a common sight: taking an array and running (well, walking) its elements through a particular function. Luckily, PHP provides a simple yet powerful function to overcome this: array_walk().

They include an example, giving a sample "some_function" the array_walk method uses when it's called, replacing a foreach (or other type of loop). Plus you can specify an object with the callback to run it against a method inside a class too.

2 comments voice your opinion now!
arraywalk function callback object method loop tutorial


blog comments powered by Disqus

Similar Posts

Jani Hartikainen's Blog: Unit testing 4: Mock objects and testing code which uses the database

JellyandCustard.com: Regular Expressions in PHP

Chris Jones' Blog: Building PHP 5.3 with Oracle HTTP Server 11g

PHPBuilder.com: Testing with the Zend Framework: How to Get Started

ZendCasts.com: Painless HTML Emails with Zend_Mail


Community Events









Don't see your event here?
Let us know!


zendframework2 community example code phpunit testing podcast tool composer interview language object development series functional introduction unittest framework release opinion

All content copyright, 2013 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework