http://net.tutsplus.com/tutorials/php/reflection-in-php/
// Nettuts.php
class Nettuts {
function publishNextArticle($editor) {
$editor->setNextArticle('135523');
$editor->publish(); // first call to publish()
$reflector = new ReflectionClass($editor);
$publishMethod = $reflector->getMethod('publish');
$publishMethod->invoke($editor); // second call to publish()
}
}
I am not able to understand what is difference between these two calls
$publishMethod->invoke($editor);
and
$editor->publish(); // first call to publish()
I mean if we already was $editor
then why would be invoke method through reflection class