Re: static functions and array_map - why not allowed?

From: Date: Tue, 13 Feb 2007 08:55:50 +0000
Subject: Re: static functions and array_map - why not allowed?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-248798@lists.php.net to get a copy of this message
Marc Weber wrote: > > Why can't I use static functions in array_map? > > Example: > > <?php > class Dummy > { > static public function T($a) > { > echo "T called with $a\n"; > return $a+2; > } > } > > function t($a) > { > echo "t called with $a\n"; > return $a*2; > } > > echo 'invoking Dummy::T works fine : ', Dummy::T(3),"\n"; > var_dump(array_map('t',array(1,2))); > var_dump(array_map('Dummy::T',array(1,2))); do it like this: var_dump(array_map(array("Dummy","T"), array(1,2))); > ?> > > Marc > > --PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#248798) next »