call_user_func_array how to use on object php >= 5.3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am working on code that implements a delegate design pattern, this makes
use of the call_user_func_array function.

I am having trouble with this particular line in PHP 5.3
return call_user_func_array(array($delegate, $methodName), $parameters);

$delegate is an object, and not simply the class name in a string.

This works in versions of PHP lower than 5.3, but it seems as though the
behaviour of this function was changed in 5.3, requiring you to pass the
class name, meaning that the method will always be called statically.

So my question is, is there any way that I can emulate the functionality of
call_user_func_array that was present in PHP < 5.3?

I would prefer not to use eval, but would like to retain the ability to call
methods within objects dynamically.

Sorry if I am not making myself clear, advice and input would be
appreciated.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux