array_walk() + class methods
| From: | Jeff Levy | Date: | Thu, 13 Dec 2001 12:17:04 +0000 |
| Subject: | array_walk() + class methods | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-78222@lists.php.net to get a copy of this message | ||
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?