#50004 [Opn->Csd]: Allow constructions like func()[0]

From: Date: Mon, 26 Oct 2009 18:52:08 +0000
Subject: #50004 [Opn->Csd]: Allow constructions like func()[0]
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-143972@lists.php.net to get a copy of this message
 ID:               50004
 User updated by:  melfar at gmail dot com
 Reported By:      melfar at gmail dot com
-Status:           Open
+Status:           Closed
 Bug Type:         Feature/Change Request
 Operating System: agnostic
 PHP Version:      5.3.0
 New Comment:

Duplicate of bug 50003


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

[2009-10-26 18:45:42] melfar at gmail dot com

Description:
------------
PHP parser doesn't allow for array index operation to be used on a 
result of a function call.  I propose a patch to allow such a 
construction.

Reproduce code:
---------------
<?php
  function car_brands() {
    return array("chevy", "hummer");
  }
  print car_brands()[1] . "\n";
?>


Expected result:
----------------
"hummer"



Actual result:
--------------
Parse error: syntax error, unexpected '[' in test.php on line 5


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=50004&edit=1



Thread (3 messages)

« previous php.bugs (#143972) next »