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:

Johannes, can you mark this bug as a duplicate of the known feature 
request, or provide a link to it? Thanks.


Previous Comments:
------------------------------------------------------------------------

[2008-03-08 21:36:45] [EMAIL PROTECTED]

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

Reply via email to