I would like to be able to call a closure that I assign to an object\'s property directly without reassigning the closure to a variable and then calling it. Is this possible
Updated:
$obj = new stdClass(); $obj->callback = function() { print "HelloWorld!"; };
PHP >= 7 :
($obj->callback)();
PHP >= 5.4 :
$callback = $obj->callback; $callback();