Our blog
PHP Calling Methods using Array_Walk
The array_walk function is one of those unassuming little PHP functions that a lot of people may well ignore, but it is often very useful and can save writing out lines of code, compressing a pretty common coding structure into a single function call. Of course that also means that it is fast!
However, the standard documentation doesn't make it clear if you can use array_walk on an array and use a class method as the callback rather than a global function. You can and here is how to do it:
-
$object = new MyClass;
More Reading:
One Comments
|
note - within the class context, simply use $this rather than $object |
RSS Feed
admin
May 14th, 2010