note 20076 added to function.function-exists

From: Date: Thu, 21 Mar 2002 14:47:33 +0000
Subject: note 20076 added to function.function-exists
Groups: php.notes 
Request: Send a blank email to php-notes+get-28040@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 -- http://www.php.net/manual/en/function.function-exists.php http://master.php.net/manage/user-notes.php?action=edit+20076 http://master.php.net/manage/user-notes.php?action=delete+20076 http://master.php.net/manage/user-notes.php?action=reject+20076

« previous php.notes (#28040) next »