What's a valid PHP callback?


in Component Event paragraph at "http://www.yiiframework.com/doc/guide/1.1/en/basics.component",

there is written:

We can attach a method to this event as follows:


where $callback refers to a valid PHP callback

then what’s a valid PHP callback?

Anything on this page:


From this page:


If that’s what you’re asking?

Forgive me for throwing links at you, but your question got me interested in brushing up my PHP knowledge.

So a callback is just a reference to some method or funtion. This reference is expressed, in the first case, as an array (Object,methodeName) and, in second case, as a simple string (functionName).

It’s Right?

Yes, correct.

It’s also worth mentioning that PHP 5.3 closures also qualify as valid callbacks e.g.

$component->onClick = function() {

    echo 'Hello I'm a closure';