Is it possible?
Normally, it requires two lines:
$instance = new MyClass();
$variable = $instance->method();
Is something like this possible in PHP?:
$variable = new MyClass()->method();
Of course, the first code is better for readability and clean code, etc., but I was just curious if you can shrink it. Maybe it could be useful, if the method returned another instance, e.g.:
$instance = new MyClass()->methodThatReturnsInstance();
Is it possible in PHP?