atom feed88 messages in net.php.lists.internalsRe: [PHP-DEV] Proposal: Array syntax
FromSent OnAttachments
20 earlier messages
Nicolas ToperNov 5, 2003 7:47 am 
Ilia AlshanetskyNov 5, 2003 7:56 am 
Antony DovgalNov 5, 2003 8:03 am 
Rasmus LerdorfNov 5, 2003 8:21 am 
Christian SchneiderNov 5, 2003 8:30 am 
Andrey HristovNov 5, 2003 8:40 am 
Ilia AlshanetskyNov 5, 2003 8:47 am 
Andi GutmansNov 5, 2003 8:47 am 
Jani TaskinenNov 5, 2003 8:49 am 
Ford, Mike [LSS]Nov 5, 2003 8:50 am 
Marco TabiniNov 5, 2003 8:52 am 
Christian SchneiderNov 5, 2003 8:54 am 
George SchlossnagleNov 5, 2003 8:58 am 
Jani TaskinenNov 5, 2003 8:59 am 
Christian SchneiderNov 5, 2003 9:00 am 
Ford, Mike [LSS]Nov 5, 2003 9:00 am 
Marco TabiniNov 5, 2003 9:01 am 
Marco TabiniNov 5, 2003 9:05 am 
Ford, Mike [LSS]Nov 5, 2003 9:07 am 
Ford, Mike [LSS]Nov 5, 2003 9:09 am 
Marco TabiniNov 5, 2003 9:18 am 
Romans MalinovskisNov 5, 2003 9:19 am 
Andi GutmansNov 5, 2003 9:20 am 
StephNov 5, 2003 9:25 am 
Andrey HristovNov 5, 2003 9:25 am 
Ilia AlshanetskyNov 5, 2003 9:25 am 
Marco TabiniNov 5, 2003 9:30 am 
Derick RethansNov 5, 2003 9:33 am 
George SchlossnagleNov 5, 2003 9:36 am 
Rasmus LerdorfNov 5, 2003 9:45 am 
Edin KadribasicNov 5, 2003 9:45 am 
Romans MalinovskisNov 5, 2003 9:48 am 
Moriyoshi KoizumiNov 5, 2003 9:50 am 
Jani TaskinenNov 5, 2003 9:54 am 
Jaap van GanswijkNov 5, 2003 10:06 am 
Michael WalterNov 5, 2003 10:12 am 
Cesare D'AmicoNov 5, 2003 10:22 am 
Marco TabiniNov 5, 2003 10:28 am 
Michael WalterNov 5, 2003 10:30 am 
Michael WalterNov 5, 2003 10:35 am 
George SchlossnagleNov 5, 2003 10:36 am 
Andrei ZmievskiNov 5, 2003 10:39 am 
George SchlossnagleNov 5, 2003 10:56 am 
David EndersonNov 5, 2003 11:02 am 
Marco TabiniNov 5, 2003 11:10 am 
Shane CaraveoNov 5, 2003 11:12 am 
Michael WalterNov 5, 2003 12:26 pm 
Greg MacLellanNov 5, 2003 12:40 pm 
Robert CummingsNov 5, 2003 1:08 pm 
David EndersonNov 5, 2003 1:19 pm 
18 later messages
Subject:Re: [PHP-DEV] Proposal: Array syntax
From:Andrey Hristov (ph@hristov.com)
Date:Nov 5, 2003 9:25:23 am
List:net.php.lists.internals

Jaap van Ganswijk wrote:

At 2003-11-05 09:59 +0100, Michael Walter wrote:

Very cool.

How about supporting .. syntax, btw. as in [1..3] or ["a".."z"]? Might no be the
worth, just thinking out loud ;)

I'm also in favor of a shorter notation for array() and list().

In fact this also helps to ease the problem I have with 'foreach ($A as $I=>$d)', because it would then be possible to write: while ([$i,$d]=each($A)).

Do you know that while(list(..,..) = each($ar)) is kinda "deprecated". You should consider using foreach() which is clearer and the fastest way to traverse an array. while() + each() + list() is the old way (evermore, you have not to forget to reset() your array before the traversal - foreach() does not need this step).

Andrey

It's still not as short as I'd like it to be: 'while ($i=>$d in $A)', but it's already a lot better.

I'd also like to see ranges supported and propose to add notations for inclusive and non-inclusive ranges as: 1..3 inclusive at both ends so equal to 1,2,3

1.<3 non inclusive at the end so equal to 1,2 1>.3 non inclusive at the beginning so equal to 2,3 1><3 non inclusive at both ends so equal to 2

Use the range() function. PHP is more close to C than to Pascal in my opinion. The language should be simple the standard library should be rich (IMO).

Andrey