note 39278 added to function.call-user-func

From: Date: Thu, 22 Jan 2004 20:20:59 +0000
Subject: note 39278 added to function.call-user-func
Groups: php.notes 
Request: Send a blank email to php-notes+get-64036@lists.php.net to get a copy of this message
I was trying to use this function to call a method of an already-instantiated object. I needed to do this with the object itself, not simply call the class' method. To accomplish this, I really avoided this particular function altogether like this: <? if ( method_exists($my_obj, $action) ){ return $my_obj->{$action}(); } ?> I hope someone else finds this useful. Note that doing this allows you to pass params to the function more-or-less in the same way you would to any other class method. ---- Manual Page -- http://www.php.net/manual/en/function.call-user-func.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39278 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39278&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39278&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#64036) next »