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,
Peter James wrote:
array_map(array('Maker', 'sGetNameId'), array(1) )
Have a look at the callback type, here:
http://www.php.net/manual/en/language.pseudo-types.php
Thanks! That did it.
Now if only PHP could treat class functions first-class citizens instead
of having making us jump
- Original Message -
From: Jean-Christian IMbeault [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, August 13, 2003 12:33 AM
Subject: [PHP] how to use array_map() with a class callback function?
I'd like to use array map with the callback function being a static
function
3 matches
Mail list logo