I'm just curious as to if creating an object on the fly is possible in PHP. I thought I'd seen it done before. Of course I can just assign it to a variable but just wondering if this possible.
new className()->someMethod();
Of course this throws a syntax error, so obviously it's not done like that (if it's even possible). Should I just assign it to a variable, as I really have no problems with doing that I was just curious?
Just some further details. Static methods aren't really an option as the class I was trying to do this for was PHPs ReflectionMethod class.
(new className())->someMethod();?