I'm searching for a short syntax like in PERL
<?php
# instead of this ( PHP )
$f = returnArray();
echo $f[2];
unset($f);
# just do this ( PERL short code )
echo (returnArray())[2];
# or this ( PERL short code )
echo returnArray()->[2];
function returnArray()
{
return array(0=>'x', 1=>'y', 2=>'This will get printed');
}
?>
The first echo will print This will get printed
The second and third are syntax errors
There is a way of doing something like this in PHP ?
Thank you