Jump to content

Calling a run-time def. method with variable para. no. WITHOUT func_num_args etc


alphard

Recommended Posts

Hi,

I deal with this: I need to call a method of an object which (both) names are decided in run-time and I need to pass it some arguments that come as a comma separated list (string). Note that I cannot change the code of the called method so I cannot use the func_num_args() etc stuff (still I can get the number of argument by Reflection).

 

I'd like it to look like this ... (actually it's more complicated as I use an array of objects to which I reffer)

 

function router($object, $method, $params)

{

    $object->$method($params);

}

 

...

 

router("myobject","mymethod","param1,param2,param3");

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.