php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #49103 Use array return value of function as array
Submitted: 2009-07-29 21:51 UTC Modified: 2010-11-24 15:10 UTC
Votes:6
Avg. Score:4.5 ± 0.8
Reproduced:5 of 5 (100.0%)
Same Version:4 (80.0%)
Same OS:3 (60.0%)
From: Mathias dot Slawik at matzelworkz dot de Assigned: jani (profile)
Status: Closed Package: *General Issues
PHP Version: 5.3.0 OS: All
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: Mathias dot Slawik at matzelworkz dot de
New email:
PHP Version: OS:

 

 [2009-07-29 21:51 UTC] Mathias dot Slawik at matzelworkz dot de
Description:
------------
There is no syntax to use an array return value of a function directly as array.

Reproduce code:
---------------
function foo() {
   return array("bar", "baz");
}

print foo()[0];

Expected result:
----------------
bar

Actual result:
--------------
Parse error: parse error on line 5

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-24 15:10 UTC] jani@php.net
-Status: Open +Status: Closed -Package: Feature/Change Request +Package: *General Issues -Assigned To: +Assigned To: jani
 [2010-11-24 15:10 UTC] jani@php.net
Array dereferencing has been added in trunk. Next release from that (maybe 5.4.0 or something else :) has it. :)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Aug 02 03:00:02 2025 UTC