Rasmus Lerdorf <[EMAIL PROTECTED]> wrote:

> I do agree that [1,2,3] is not easier to read than array(1,2,3), but I 
> don't think there is a huge difference between the two.  I guess we could 
> sample a few newbie users to see what they think $a = [1,2,3]; would do.
> Of course, then people are going to try to do $a = $b[1,2,3]; and then we 
> are all messed up.

Yeah, it will mess us up all. I did a quick hack to realise this 
feature. The patch is pasted below.

<?php
$a = array('ArrayArray' => 'nay');
var_dump($a[[0].[0]]);
?>

Indeed this works :) I'm not much interested in this kind of discussion 
though.

Moriyoshi

Index: Zend/zend_language_parser.y
===================================================================
RCS file: /repository/Zend/Attic/zend_language_parser.y,v
retrieving revision 1.23
diff -u -r1.23 zend_language_parser.y
--- Zend/zend_language_parser.y 4 Aug 2002 06:39:44 -0000       1.23
+++ Zend/zend_language_parser.y 5 Nov 2003 17:42:40 -0000
@@ -484,6 +484,7 @@
        |       '@' { zend_do_begin_silence(&$1 TSRMLS_CC); } expr { zend_do_end
_silence(&$1 TSRMLS_CC); $$ = $3; }
        |       scalar                          { $$ = $1; }
        |       T_ARRAY '(' array_pair_list ')' { $$ = $3; }
+       |       '[' array_pair_list ']' { $$ = $2; }
        |       '`' encaps_list '`'             { zend_do_shell_exec(&$$, &$2 TS
RMLS_CC); }
        |       T_PRINT expr  { zend_do_print(&$$, &$2 TSRMLS_CC); }
 ;

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to