Hi,
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:
$component->onClicked=$callback;
where $callback refers to a valid PHP callback
then what’s a valid PHP callback?
jacmoe
(Jacob Moen)
May 11, 2011, 6:11pm
2
Anything on this page:
http://uk2.php.net/manual/en/language.pseudo-types.php#language.types.callback
From this page:
http://www.lornajane.net/posts/2011/Callbacks-in-PHP
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?
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';
}