NYCPHP Meetup

NYPHP.org

[nycphp-talk] Callback syntax

John Campbell jcampbell1 at gmail.com
Wed Dec 12 14:11:11 EST 2007


> It doesn't seem to work.  I'm not sure of the syntax to do this. moveUp(
> ) is a method of the class,
> but I'm not sure how to tell it, call_user_func( ), since I need the
> syntax to be $this->functionName( ).

Replace:
call_user_func($this->$callbackFunction);
with:
$this->$callbackFunction();

see http://us.php.net/manual/en/functions.variable-functions.php for
an explanation.

call_user_func() treats everything as a static method and will not work.


Regards,
John Campbell



More information about the talk mailing list