On Sun, May 7, 2006 1:20 pm, Chris Jenkinson wrote:
> Currently I have a function which accepts a limited number of
> parameters:
>
> call_function($function_name, &$var_1, &$var_2);
>
> I wish to modify the function to accept an indefinite number of
> parameters, which may or may not be references
Oops, returning the wrong thing. Corrected below...
function call_function($function_name, &$vars)
{
$code = '$retval = '.$function.'(';
$params = array();
foreach (array_keys($vars) as $key)
$params[] = '$var['.$key.']';
$code .= implode(',', $params);
$code .= ');';
eva
Chris Jenkinson wrote:
Currently I have a function which accepts a limited number of parameters:
call_function($function_name, &$var_1, &$var_2);
I wish to modify the function to accept an indefinite number of
parameters, which may or may not be references.
The function call_function() then
Jochem Maas wrote:
that smells like bad design (but then again you should see some of my
code ;-)
I blame PHP not allowing func_get_args() to use references, rather than
bad design on my part. :)
i can say with confidence 'no, your out of luck'.
There must be some clever workaround u
Tom Rogers wrote:
Here is a cutdown version of a class loader I use, It works for php4 and
php5 and with references. It should be easy to modify.
[...]
Sorry, this does not work with references as func_get_args() copies the
arguments passed, rather than keeping them as references. This means
Eric Butera wrote:
One thing you could do is (assuming it's php4)
[...]
This is a bit of a pain though. :)
Unfortunately, changing the functions to use &$params and using
extract() is a significant API change and as such it would be a large
amount of effort.
Chris
--
Chris Jenkinson
[E
Hi,
Monday, May 8, 2006, 4:20:11 AM, you wrote:
CJ> Hi,
CJ> Currently I have a function which accepts a limited number of parameters:
CJ> call_function($function_name, &$var_1, &$var_2);
CJ> I wish to modify the function to accept an indefinite number of
CJ> parameters, which may or may not be
On 5/7/06, Chris Jenkinson <[EMAIL PROTECTED]> wrote:
Hi,
Currently I have a function which accepts a limited number of parameters:
call_function($function_name, &$var_1, &$var_2);
I wish to modify the function to accept an indefinite number of
parameters, which may or may not be references.
Chris Jenkinson wrote:
Jochem Maas wrote:
although I wonder whether you shouldn't be re-evaluating what it is
your trying to do because I get the impression it's a whole load of work
for probably little payoff (consider that using alot of indirection in
your
code will make it harder to underst
Jochem Maas wrote:
although I wonder whether you shouldn't be re-evaluating what it is
your trying to do because I get the impression it's a whole load of work
for probably little payoff (consider that using alot of indirection in your
code will make it harder to understand/read and therefore har
Chris Jenkinson wrote:
Hi,
Currently I have a function which accepts a limited number of parameters:
call_function($function_name, &$var_1, &$var_2);
I wish to modify the function to accept an indefinite number of
parameters, which may or may not be references.
The function call_function()
11 matches
Mail list logo