Reputation: 897
Is it possible it instantiate a new class and get a property without assigning it to a variable object.
example:
$fileid = 1;
$filepath = new fileclass($fileid)->path;
I know the above is incorrect but is the concept possible?
Upvotes: 2
Views: 66
Reputation: 212412
It is in PHP >= 5.4.0
$filepath = (new fileclass($fileid))->path;
The brackets are important
Upvotes: 6