Re: array_walk() + class methods
| From: | Papp Gyozo | Date: | Fri, 21 Dec 2001 10:48:31 +0000 |
| Subject: | Re: array_walk() + class methods | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-78488@lists.php.net to get a copy of this message | ||
array_walk($ar, array(&$object, 'methodname'));
----- Original Message -----
From: "Jeff Levy" <php4@meta-craft.com>
To: <php-general@lists.php.net>
Sent: Thursday, December 13, 2001 1:17 PM
Subject: [PHP] array_walk() + class methods
| I'd like to call a class method with array_walk(). Is this possible?
|
| class widget {
| function sicballs($arg){
| print $arg;
| }
| }
|
| $x = new widget();
|
| $ar = array('my','values');
|
| array_walk($ar, ???)
|
| ...
|
| the only way I've been able to get this (simplified) code to work the way
| I want it is:
|
| function snafu($arg) {
| global $x;
| call_user_method("sicballs", $x, $arg);
| }
|
| obviously, I want to call the method direcly, without writing this
| function, snafu()...
|
| anyone know?
|
| --
| PHP General Mailing List (http://www.php.net/)
| To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
| For additional commands, e-mail: php-general-help@lists.php.net
| To contact the list administrators, e-mail: php-list-admin@lists.php.net
|