static functions and array_map - why not allowed?
| From: | Marc Weber | Date: | Tue, 13 Feb 2007 09:49:39 +0000 |
| Subject: | static functions and array_map - why not allowed? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-248797@lists.php.net to get a copy of this message | ||
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)));
?>
Marc