note 73682 added to function.array-walk-recursive
| From: | wileur at gmail dot com | Date: | Tue, 06 Mar 2007 13:59:48 +0000 |
| Subject: | note 73682 added to function.array-walk-recursive | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-124156@lists.php.net to get a copy of this message | ||
A simple way to use callback functions that are defined in a class is to simply pass the class
instance and function names as values in an array:
<?php
class testClass {
function callbackFunction($value, $key) {
echo "$key: $value<br />\n";
}
function printArray($foo) {
array_walk_recursive($foo, array($this, 'callbackFunction'));
}
}
?>
----
Server IP: 129.16.214.50
Probable Submitter: 213.66.59.80
----
Manual Page -- http://www.php.net/manual/en/function.array-walk-recursive.php
Edit -- https://master.php.net/note/edit/73682
Del: integrated -- https://master.php.net/note/delete/73682/integrated
Del: useless -- https://master.php.net/note/delete/73682/useless
Del: bad code -- https://master.php.net/note/delete/73682/bad+code
Del: spam -- https://master.php.net/note/delete/73682/spam
Del: non-english -- https://master.php.net/note/delete/73682/non-english
Del: in docs -- https://master.php.net/note/delete/73682/in+docs
Del: other reasons-- https://master.php.net/note/delete/73682
Reject -- https://master.php.net/note/reject/73682
Search -- https://master.php.net/manage/user-notes.php