|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-03-08 21:36 UTC] johannes@php.net
[2008-03-09 01:11 UTC] php at xyzzy dot cjb dot net
[2008-03-09 11:15 UTC] felipe@php.net
[2008-03-09 19:31 UTC] php at xyzzy dot cjb dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 18 11:00:01 2025 UTC |
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