note 84193 added to function.array-walk
| From: | puremango dot co dot uk at gmail dot com | Date: | Wed, 02 Jul 2008 19:49:51 +0000 |
| Subject: | note 84193 added to function.array-walk | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-141085@lists.php.net to get a copy of this message | ||
to array_walk with a function defined in a class, try this:
<?
// 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.
----
Server IP: 92.48.74.199
Probable Submitter: 79.65.178.134
----
Manual Page -- http://www.php.net/manual/en/function.array-walk.php
Edit -- https://master.php.net/note/edit/84193
Del: integrated -- https://master.php.net/note/delete/84193/integrated
Del: useless -- https://master.php.net/note/delete/84193/useless
Del: bad code -- https://master.php.net/note/delete/84193/bad+code
Del: spam -- https://master.php.net/note/delete/84193/spam
Del: non-english -- https://master.php.net/note/delete/84193/non-english
Del: in docs -- https://master.php.net/note/delete/84193/in+docs
Del: other reasons-- https://master.php.net/note/delete/84193
Reject -- https://master.php.net/note/reject/84193
Search -- https://master.php.net/manage/user-notes.php