php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #23920 array index of function result does not parse: func()[10]
Submitted: 2003-05-31 07:44 UTC Modified: 2006-04-03 12:51 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: dustin+php at cs dot uchicago dot edu Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.3.1 OS: Solaris, Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dustin+php at cs dot uchicago dot edu
New email:
PHP Version: OS:

 

 [2003-05-31 07:44 UTC] dustin+php at cs dot uchicago dot edu
Why can't I do this:

 $year = getdate($timestamp)['year'];

(syntax error) while I can do this:

 $temp = getdate($timestamp);
 $year = $temp['year'];

it seems that a complete parser should be able to parse the first line.  Others have suggested writing a function to duplicate this functionality, but this can get pretty ugly.  Still others have suggested eval(), but that's playing with fire when you're using data from the network.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-03 12:51 UTC] tony2001@php.net
Duplicate of bug #23022.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 01:01:30 2024 UTC