note 20076 deleted from function.function-exists by irc-html

From: Date: Fri, 19 Apr 2002 22:22:25 +0000
Subject: note 20076 deleted from function.function-exists by irc-html
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-29585@lists.php.net to get a copy of this message
Problem: What about calling methods of objects? It took me some time to find out because this is not well documented. Sometimes there helps a look into the sources... Here we go: Since call_user_method_array is deprecated there must be a way to use call_user_func_array on methods. This example shows how: ------------------ $mycart = new Cart; $mymethod = 'Add_Item' call_user_func_array(array($mycart,$mymethod),$args); ------------------ Instead of just passing a function, pass an array tuple with (objectname,methodname) and you'll be fine! Code on, Matthias

« previous php.notes (#29585) next »