Possible Duplicate:
Calling closure assigned to object property directly
Why this is not possible in PHP? I want to be able to create a function on the fly for a particular object.
$a = 'a';
$tokenMapper->tokenJoinHistories = function($a) {
echo $a;
};
$tokenMapper->tokenJoinHistories($a);
With
$obj->foo()you call methods, but you want to call a property as a function/method. This just confuses the parser, because he didn’t find a method with the namefoo(), but he cannot expect any property to be something callable.Or you extend your mapper like
(There are probably some issues within this quickly written example)