how to use array_map() with a class callback function?
| From: | Jean-Christian IMbeault | Date: | Wed, 13 Aug 2003 06:33:45 +0000 |
| Subject: | how to use array_map() with a class callback function? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-159400@lists.php.net to get a copy of this message | ||
I'd like to use array map with the callback function being a static function in a class. How can I do that?
I have tried:
class Maker {
function sGetNameId($a) {
return 1;} } array_map("Maker::sGetNameId", array("1") ) But I get this error: array_map(): The first argument, 'Maker::sGetNameId', should be either NULL or a valid callback Is it possible to use class functions as callback functions? Thanks, Jean-Christian Imbeault