Ben PERL gibi kısa bir sözdizimi Arıyorum
<?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
PHP böyle bir şey yapmanın bir yolu var mı?