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
-- Peter James Editor-in-Chief, php|architect Magazine [EMAIL PROTECTED] php|architect The Magazine for PHP Professionals http://www.phparch.com ----- 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 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 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php