note 84193 deleted from function.array-walk by danbrown
| From: | danbrown@php.net | Date: | Thu, 28 Oct 2010 16:18:38 +0000 |
| Subject: | note 84193 deleted from function.array-walk by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-173562@lists.php.net to get a copy of this message | ||
Note Submitter: puremango dot co dot uk at gmail dot com
----
to array_walk with a function defined in a class, try this:
<?php
// An example callback method
class MyClass {
static function myCallbackMethod($data) {
return $data.$data;
}
}
$my_array = array('one','two','three');
// Static class method cal
array_walk($my_array,array('MyClass', 'myCallbackMethod'));
?>
returns array('oneone','twotwo','threethree');
code from: http://uk.php.net/manual/en/language.pseudo-types.php
thought it would be useful here.