note 69596 added to function.call-user-func
| From: | Typer85 at gmail dot com | Date: | Tue, 12 Sep 2006 10:57:30 +0000 |
| Subject: | note 69596 added to function.call-user-func | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-117050@lists.php.net to get a copy of this message | ||
I would just like to say at first that I prefer variable function calls over the use of this
function.
However I found that at some times, the use of this function is needed in situtations where variable
function calls can not be used. And in those same situations, the use of this function is also
better than using eval.
The situation I ran into is this:
I wanted to call object methods dynamically from within the object but with arguments given for
possible parameters that the method I will call requires.
The parameters themselves are dynamic, meaning I have no prior knowledge of how many their are,
their values, or if they even exist.
Also because object methods are dynamic, meaning I have no prior knowledge which object method will
actually be called, I can not simply use variable function calls, call the method and pass any
parameters.
So what I simply do is call the object method with an array of parameters, something that, to the
best of my knowledge, can not be done with variable function calls, since variable function calls,
even though they themeselves are dynamic, passing parameters to them is not.
----
Server IP: 66.163.161.117
Probable Submitter: 62.193.102.124
----
Manual Page -- http://www.php.net/manual/en/function.call-user-func.php
Edit -- https://master.php.net/note/edit/69596
Del: integrated -- https://master.php.net/note/delete/69596/integrated
Del: useless -- https://master.php.net/note/delete/69596/useless
Del: bad code -- https://master.php.net/note/delete/69596/bad+code
Del: spam -- https://master.php.net/note/delete/69596/spam
Del: non-english -- https://master.php.net/note/delete/69596/non-english
Del: in docs -- https://master.php.net/note/delete/69596/in+docs
Del: other reasons-- https://master.php.net/note/delete/69596
Reject -- https://master.php.net/note/reject/69596
Search -- https://master.php.net/manage/user-notes.php