What I would like to do is something like this:
$method_result = new Obj()->method();
Instead of having to do:
$obj = new Obj(); $method_result = $obj->method();
The result doesn't actually matter to me in my specific case. But, is there a way to do this?
The feature you have asked for is available from PHP 5.4. Here is the list of new features in PHP 5.4:
And the relevant part from the new features list: