Re: [SPAM] Re: [PHP-DEV] Syntactic improvement to array
| From: | Robert Cummings | Date: | Sun, 04 Feb 2007 23:11:52 +0000 |
| Subject: | Re: [SPAM] Re: [PHP-DEV] Syntactic improvement to array | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-27777@lists.php.net to get a copy of this message | ||
On Sun, 2007-02-04 at 19:38 +0100, Edin Kadribasic wrote:
> Lukas Kahwe Smith wrote:
> > Yes, you will come across it if its added.
> > I find the Javascript syntax confusing to read as well. However more
> > importantly I do not see the point in adding this sugar to save 5 chars.
>
> Nested arrays become very unreadable with the current PHP syntax. I
> think killing those 5 chars per array would actually make thing more
> readable.
>
>
> I don't find:
>
> $a = [1 => ['pears', 'apples'], 2 => ['juice',
> 'oranges']];
>
> any less readable than:
>
> $a = array(1 => array('pears', 'apples'), 2 =>
> array('juice', 'oranges'));
>
> Quite the opposite actually :)
Depends on how you format multi-level arrays...
$a = array
(
1 => array
(
'pears',
'apples',
),
2 => array
(
'juice',
'organge',
),
);
In the new format...
$a =
[
1 =>
[
'pears',
'apples',
],
2 =>
[
'juice',
'organge',
],
];
Can't say that I see a terribly great advantage in readability.
-0 :)
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'