http://us3.php.net/manual/en/language.pseudo-types.phpHi guys. I want to call this generic echo function within a class, but have trouble referencing the output function with $this-> . Any suggestions? Maybe there is a better solution to this?
This is within a class:
[snip]
# generic WALK functions
function walkit($array)
{
array_walk($array,"$this->output"); //not
working
}
function output($item,$key)
{
echo "$key. $item<br />\n"; }
thomas
"A method of an instantiated object is passed as an array containing an object as the element with index 0 and a method name as the element with index 1."
function walkit($array){ array_walk($array,array($this,'output')); } function output($item,$key){ echo "$key. $item<br />\n"; }
-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php