Edit report at https://bugs.php.net/bug.php?id=60408&edit=1
ID: 60408 User updated by: bugzilla33 at gmail dot com Reported by: bugzilla33 at gmail dot com -Summary: Array constructor dereferencing support +Summary: Array element access on instantiation (same like class member in 5.4RC) Status: Open Type: Feature/Change Request Package: Scripting Engine problem PHP Version: 5.4.0RC2 Block user comment: N Private report: N New Comment: (edit summary) Previous Comments: ------------------------------------------------------------------------ [2011-11-29 14:40:01] bugzilla33 at gmail dot com 20 Jun 2011, PHP 5.4.0 Alpha 1 -> Added array dereferencing support. (Felipe) 11 Nov 2011, PHP 5.4.0 RC1 -> Added class member access on instantiation (e.g. (new foo)->bar()) support. (Felipe) Many thanks for Felipe. It would be nice to add: Array element access on instantiation array()[$x] and [][$x] Then everything would be fully useful, but not in part. ------------------------------------------------------------------------ [2011-11-29 12:06:24] bugzilla33 at gmail dot com Description: ------------ Please add array constructor dereferencing support like JavaScript, C# and all languages excluding PHP 5.4 Test script: --------------- <?php $i=0; print(array('pa','th')[$i++]); // pa print(['wa','ss'][$i++]); // ss ?> Expected result: ---------------- Parse error: syntax error, unexpected '[' in C:\htdocs\test.pl\array.php on line 4 Actual result: -------------- pass ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60408&edit=1