Good day to all!
Earlier, when creating an object of a class, I somehow did not think about the convenient creation of an object and the use of its useful functionality "on the fly" (ie, in line). Probably, the lion's share of OO languages supports this feature. How is the same with PHP?
Usually, useful class functionality is used by first creating an object and then calling its methods / using class variables:
$OBJECT = new Object(); $OBJECT -> CallUsefulMethod(); But in many cases it is precisely known that the object will be used once, therefore, in assigning it to a. there is no point in a variable. However, this is the beauty of creation "on the fly." Are there ways to do something like this in PHP (?):
(new Object()) -> CallUsefulMethod(); Thank ;)