Edit report at https://bugs.php.net/bug.php?id=63712&edit=1
ID: 63712 Updated by: ni...@php.net Reported by: tretoria at data dot bg Summary: function returning array and directly calling array element parse error -Status: Open +Status: Closed Type: Feature/Change Request Package: Compile Failure Operating System: win32 PHP Version: 5.3.19 -Assigned To: +Assigned To: nikic Block user comment: N Private report: N New Comment: This feature was added in PHP 5.4. Previous Comments: ------------------------------------------------------------------------ [2012-12-06 15:13:52] tretoria at data dot bg Description: ------------ When calling function which returns array and try to get element of the returned array directly, without copying the result into variable like "foo()[x]" where x is integer, it returns parse syntax error. However this is working in 5.4.* versions. Test script: --------------- <?php function returnArray() { $arr = array("first", "second", "third"); return $arr; } echo returnArray()[1]; ?> Expected result: ---------------- second Actual result: -------------- Parse error: syntax error, unexpected '[', expecting ',' or ';' ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63712&edit=1