Basically what i mentioned in the title is what i am trying to do and im not sure if its possible to do or not.
I have:
$myClass = new Class();
$var = $myClass->someFunction();
But then i never use $myClass again an i could unset it to free up memory. however im trying to clean up my code at the same time and wondered if the following is valid
$var = (new Class())->someFunction();
And if its not what would you guys suggest?
Thanks!
You can always declare
someFunction()as astaticmethod.