php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30467 Array expression parsing problem
Submitted: 2004-10-18 03:32 UTC Modified: 2004-10-30 01:05 UTC
From: cpks at btopenworld dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: Irrelevant OS: N/A
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: cpks at btopenworld dot com
New email:
PHP Version: OS:

 

 [2004-10-18 03:32 UTC] cpks at btopenworld dot com
Description:
------------
I had been assuming that the expression

$a = functioncall(), $a{operator}

is equivalent to

functioncall(){operator}

but this appears to be the untrue, at least in the case of functions returning array values.

Be kind to me. I'm sure I'm being stupid.

Reproduce code:
---------------
echo getdate()["year"];

Expected result:
----------------
2004

//(or whatever year it is)

Actual result:
--------------
parse error: unexpected "[", expecting "," or ";"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-18 07:57 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Nope, this is not supposed to work at all. No bug here.
 [2004-10-30 01:05 UTC] cpks at btopenworld dot com
Brr! Never coming back HERE again!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC