#44368 [Bgs]: Syntax to index within an expression that evaluates to an array
ID: 44368
User updated by: php at xyzzy dot cjb dot net
Reported By: php at xyzzy dot cjb dot net
Status: Bogus
Bug Type: Feature/Change Request
Operating System: Mac OS X 10.5.2
PHP Version: 5.2.5
New Comment:
http://bugs.php.net/bug.php?id=43577 was closed
as "Won't fix" with
only
the message "We discussed this already as well a few times, also not
going to happen."
I can't commit there since the bug is closed, but what is the reasoning
behind not allowing this bug to be fixed? (The bug didn't link to the
discussion, and I wasn't able to find it.) Does "Won't fix" mean
a) the developers have no plans to fix this themselves, but will
consider patches that fix it?
b) or, this change is not desired, and any third-party fixes will be
rejected?
Previous Comments:
------------------------------------------------------------------------
[2008-03-09 11:15:44] felipe@php.net
http://bugs.php.net/bug.php?id=43577
------------------------------------------------------------------------
[2008-03-09 01:11:38] php at xyzzy dot cjb dot net
Johannes, can you mark this bug as a duplicate of the known feature
request, or provide a link to it? Thanks.
------------------------------------------------------------------------
[2008-03-08 21:36:45] johannes@php.net
This request was made multiple times before, currently there's no
developer having a good fix for that, setting to bogus since it's a
known request.
------------------------------------------------------------------------
[2008-03-08 06:31:37] php at xyzzy dot cjb dot net
Description:
------------
It would be nice if PHP could allow you to use the [] operator to index
within an expression that evaluates to an array, as if it was a
variable.
This feature request is similar to #41268 "Access array member without
variable", but suggests using the existing [] operator rather than
adding a new function. I could not find further details on
php-internals
about this issue.
Reproduce code:
---------------
For example:
$lines = split("\n", $text)
print $lines[0]
cannot currently be written as
print split("\n", $text)[0]
nor
print (split("\n", $text))[0]
Expected result:
----------------
The second and third examples behave identically to the first.
Actual result:
--------------
Parse error: syntax error, unexpected '[' in - on line 2
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44368&edit=1
Thread (5 messages)