I'm just curious to know if creating an object on the fly is possible in PHP. I thought I saw this before. Of course, I can just assign it to a variable, but just wondering if this is possible.
new className()->someMethod();
Of course, this causes a syntax error, so obviously this is not the case (if possible). Should I just assign it to a variable, since I really have no problem with this, was I just wondering?
A few more details. Static methods are not really an option, since the class I tried to do is the PHP class ReflectionMethod.
source share