我喜歡在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');
}
?>
尋找一個短語法的第一回波將打印這將讓打印
第二類和第三類語法錯誤
在PHP中有這樣的事情嗎?
[PHP:獲得數組元素]的可能重複(http://stackoverflow.com/questions/3484832/php-get-array-element) – VolkerK 2010-08-25 10:24:22
[數組解除引用將很快來到你身邊的PHP](http: //schlueters.de/blog/archives/138-Features-in-PHP-trunk-Array-dereferencing.html) – Gordon 2010-08-25 10:27:06