|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-03-20 19:18 UTC] php dot net at doppy dot nl
[2012-03-21 00:51 UTC] aharvey@php.net
[2012-03-21 00:51 UTC] aharvey@php.net
-Status: Open
+Status: Closed
-Package: Feature/Change Request
+Package: *General Issues
-Assigned To:
+Assigned To: felipe
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 05:00:02 2025 UTC |
Description: ------------ Cannot use square brackets to directly reference array elements in the returned value of a function. As a flexible language that can do pretty much anything, it seems logical to be able to achieve this on one line, without having to first assign the return value to a temporary variable. Reproduce code: --------------- function test() { return array('a', 'b'); } //desired echo test()[0]; //workaround //$temp = test(); //echo $temp[0]; Expected result: ---------------- a Actual result: -------------- Parse error: syntax error, unexpected '['