Edit report at https://bugs.php.net/bug.php?id=60408&edit=1
ID: 60408 Updated by: larue...@php.net Reported by: bugzilla33 at gmail dot com Summary: Array/String 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 -Assigned To: +Assigned To: dmitry Block user comment: N Private report: N New Comment: Dmitry, could you look at this please? thanks patch and test list in: https://wiki.php.net/rfc/constdereference All existing test passed. Previous Comments: ------------------------------------------------------------------------ [2011-11-30 08:40:17] lunter at interia dot pl I'm all for it. example: short switch/case alternative -------------------------------------- <?php echo 'ABC'[$i] // or echo ['A','B','C'][$i] ?> is equivalent to long: <?php switch ($i) { case 0: echo "A"; break; case 1: echo "B"; break; case 2: echo "C"; break; } ?> ------------------------------------------------------------------------ [2011-11-30 07:47:07] bugzilla33 at gmail dot com /Summary change/ Array -> Array/String ------------------------------------------------------------------------ [2011-11-30 07:36:07] larue...@php.net support (of course). yes, but it need to be disscussd first ;) ------------------------------------------------------------------------ [2011-11-30 07:29:12] bugzilla33 at gmail dot com >> echo array(1, 2, 3)[0]; //output 1 >> echo "foobar"[2]; //output o >> echo "foobar"["foo"][0] // output f >> works. Excellent! Have you tested it with short array constructor? echo [1, 2, 3][0]; //output 1 Are there any opportunities to make it public in the final PHP 5.4? ------------------------------------------------------------------------ [2011-11-30 06:04:19] larue...@php.net see https://wiki.php.net/rfc/constdereference ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=60408 -- Edit this bug report at https://bugs.php.net/bug.php?id=60408&edit=1