99 messages in net.php.lists.internalsRe: [PHP-DEV] Re: Short syntax for ar...
FromSent OnAttachments
Stan Vassilev | FMMay 21, 2008 7:12 pm 
Felipe PenaMay 21, 2008 7:20 pm 
Stanislav MalyshevMay 21, 2008 8:53 pm 
Pierre JoyeMay 22, 2008 2:46 am 
Antony DovgalMay 22, 2008 2:56 am 
Pierre JoyeMay 22, 2008 3:33 am 
Johannes SchlüterMay 22, 2008 6:56 am 
Pierre JoyeMay 22, 2008 7:28 am 
Philip OlsonMay 22, 2008 8:55 am 
Stanislav MalyshevMay 22, 2008 9:17 am 
Andi GutmansMay 22, 2008 9:15 pm 
Brian MoonMay 22, 2008 9:29 pm 
LokrainMay 23, 2008 1:28 am 
Pierre JoyeMay 23, 2008 1:58 am 
Alexey ZakhlestinMay 23, 2008 2:06 am 
Jani TaskinenMay 23, 2008 4:45 am 
Eric ColemanMay 23, 2008 6:43 am 
Yi WangMay 23, 2008 8:17 am 
Sebastian DeutschMay 27, 2008 1:53 pm 
Sebastian DeutschMay 27, 2008 3:58 pm 
Stanislav MalyshevMay 27, 2008 4:10 pm 
Jani TaskinenMay 27, 2008 4:14 pm 
Stanislav MalyshevMay 27, 2008 4:18 pm 
Sebastian DeutschMay 27, 2008 4:21 pm 
Rasmus LerdorfMay 27, 2008 5:27 pm 
Andrei ZmievskiMay 27, 2008 5:48 pm 
Sebastian DeutschMay 27, 2008 6:09 pm 
Greg BeaverMay 27, 2008 7:43 pm 
Philip OlsonMay 27, 2008 8:45 pm 
Stanislav MalyshevMay 27, 2008 11:15 pm 
Antony DovgalMay 27, 2008 11:21 pm 
Stanislav MalyshevMay 27, 2008 11:25 pm 
Antony DovgalMay 27, 2008 11:28 pm 
Derick RethansMay 27, 2008 11:31 pm 
Rasmus LerdorfMay 27, 2008 11:43 pm 
Pierre JoyeMay 27, 2008 11:52 pm 
Antony DovgalMay 28, 2008 12:11 am 
Hans ÅhlinMay 28, 2008 12:14 am 
Derick RethansMay 28, 2008 12:19 am 
Alexey ZakhlestinMay 28, 2008 12:24 am 
Antony DovgalMay 28, 2008 12:32 am 
Stanislav MalyshevMay 28, 2008 12:33 am 
Antony DovgalMay 28, 2008 12:41 am 
Stanislav MalyshevMay 28, 2008 1:02 am 
Antony DovgalMay 28, 2008 1:14 am 
Stefan WalkMay 28, 2008 1:32 am 
Lukas Kahwe SmithMay 28, 2008 1:43 am 
LokrainMay 28, 2008 1:47 am 
Stan Vassilev | FMMay 28, 2008 2:34 am 
Jon L.May 28, 2008 2:35 am 
David ZülkeMay 28, 2008 2:54 am 
LokrainMay 28, 2008 2:58 am 
Felipe PenaMay 28, 2008 4:27 am 
Ford, MikeMay 28, 2008 4:34 am 
Greg BeaverMay 28, 2008 4:57 am 
Richard QuadlingMay 28, 2008 6:13 am 
Brian MoonMay 28, 2008 8:20 am 
Andi GutmansMay 28, 2008 8:28 am 
Andi GutmansMay 28, 2008 8:28 am 
Chris StocktonMay 28, 2008 8:56 am 
MikeMay 28, 2008 10:10 am 
Jani TaskinenMay 28, 2008 10:25 am 
Chris StocktonMay 28, 2008 10:54 am 
Brian MoonMay 28, 2008 11:06 am 
Jared WilliamsMay 28, 2008 11:30 am 
Gregory BeaverMay 28, 2008 12:11 pm 
Pierre JoyeMay 28, 2008 12:32 pm 
Chris StocktonMay 28, 2008 12:43 pm 
Stanislav MalyshevMay 28, 2008 1:06 pm 
Stanislav MalyshevMay 28, 2008 1:16 pm 
Rasmus LerdorfMay 28, 2008 9:31 pm 
Derick RethansMay 29, 2008 3:56 am 
Derick RethansMay 29, 2008 4:03 am 
Pierre JoyeMay 29, 2008 4:10 am 
Marcus BoergerMay 29, 2008 5:48 am 
Brian MoonMay 29, 2008 7:54 am 
Jonathan Bond-CaronMay 29, 2008 8:02 am 
Sebastian DeutschMay 29, 2008 9:13 am 
Johannes SchlüterMay 29, 2008 11:55 am 
Johannes SchlüterMay 29, 2008 12:05 pm 
Chris StocktonMay 29, 2008 1:32 pm 
Johannes SchlüterMay 29, 2008 2:44 pm 
Jani TaskinenMay 29, 2008 3:06 pm 
Stanislav MalyshevMay 29, 2008 4:03 pm 
Lester CaineMay 30, 2008 12:04 am 
Pierre JoyeMay 30, 2008 2:00 am 
Sebastian DeutschMay 30, 2008 8:19 am 
Philip OlsonMay 30, 2008 9:14 am 
Sebastian DeutschMay 30, 2008 9:23 am 
Lars StrojnyMay 31, 2008 5:27 am 
Hans ÅhlinMay 31, 2008 6:17 am 
Hans ÅhlinMay 31, 2008 6:26 am 
Hans ÅhlinMay 31, 2008 6:38 am 
Chris StocktonMay 31, 2008 8:42 am 
Sebastian DeutschMay 31, 2008 8:42 am 
Lars StrojnyMay 31, 2008 9:33 am 
Stanislav MalyshevMay 31, 2008 10:45 pm 
Marcin KurzynaJun 1, 2008 5:23 am 
Rodrigo SaboyaJun 2, 2008 12:29 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [PHP-DEV] Re: Short syntax for array literals [...]Actions...
From:Stan Vassilev | FM (sv_f@fmethod.com)
Date:May 28, 2008 2:34:03 am
List:net.php.lists.internals

Hi,

No one said it's a matter of life and death. But is it only a matter of life and death improvements that should be considered for PHP?

The typical use case that benefits most from this is when a function accepts arrays as a means of structured/named/nested options, something I use a lot.

Compare verbosity and readability:

quoteInto('SELECT * FROM Table WHERE x > ? and y < ?', array(10, 50)); vs: quoteInto('SELECT * FROM Table WHERE x > ? and y < ?', [10, 50]);

renderSomething(array('exclude' => array('a', 'b', 'c'), 'include' => array('d', 'e', 'f'))); vs: renderSomething(['exclude' => ['a', 'b', 'c'], 'include' => ['d', 'e', 'f']]); or even vs: renderSomething(['exclude' : ['a', 'b', 'c'], 'include' : ['d', 'e', 'f']]);

The key thing is, no one is requesting that array() be removed. Just that an obvious and commonly used shortcut is added. It's not confusing, it's not hard, JavaScript also has BOTH short and long syntax for arrays and objects:

var array = new Array(); -- same as -- var array = []; var object = new Object(); -- same as -- var object = {};

And when people have both of those, guess which one they use in more than 90% of the cases.

Regards, Stan Vassilev

Hello,

As I always will say -1 to this.

But I have a question, people here talk that this is very very useful in some cases. Can you please show others such cases so we can get your point? I really want to know this super hyper cases, this syntax is mega useful.

Regards, Dimitar