| From | Sent On | Attachments |
|---|---|---|
| 1 earlier message | ||
| Marcus Boerger | Feb 4, 2007 2:09 am | |
| phpxcache | Feb 4, 2007 3:18 am | |
| Pierre | Feb 4, 2007 3:24 am | |
| Edin Kadribasic | Feb 4, 2007 5:00 am | |
| Johannes Schlüter | Feb 4, 2007 5:17 am | |
| Nico Haase | Feb 4, 2007 5:43 am | |
| Hannes Magnusson | Feb 4, 2007 5:53 am | |
| Christian Schneider | Feb 4, 2007 6:23 am | |
| Hannes Magnusson | Feb 4, 2007 6:29 am | |
| Christian Schneider | Feb 4, 2007 6:57 am | |
| Pierre | Feb 4, 2007 7:23 am | |
| Andi Gutmans | Feb 4, 2007 8:15 am | |
| Andi Gutmans | Feb 4, 2007 8:16 am | |
| Lukas Kahwe Smith | Feb 4, 2007 8:29 am | |
| Rasmus Lerdorf | Feb 4, 2007 8:36 am | |
| Zeev Suraski | Feb 4, 2007 8:58 am | |
| Ilia Alshanetsky | Feb 4, 2007 9:27 am | |
| Andi Gutmans | Feb 4, 2007 9:39 am | |
| Ilia Alshanetsky | Feb 4, 2007 9:48 am | |
| Pierre | Feb 4, 2007 10:13 am | |
| Steph | Feb 4, 2007 10:16 am | |
| Steph | Feb 4, 2007 10:17 am | |
| Lukas Kahwe Smith | Feb 4, 2007 10:29 am | |
| Mike Robinson | Feb 4, 2007 10:30 am | |
| Ilia Alshanetsky | Feb 4, 2007 10:33 am | |
| Lukas Kahwe Smith | Feb 4, 2007 10:37 am | |
| Edin Kadribasic | Feb 4, 2007 10:37 am | |
| Pierre | Feb 4, 2007 10:40 am | |
| Derick Rethans | Feb 4, 2007 10:56 am | |
| Derick Rethans | Feb 4, 2007 11:00 am | |
| Marcus Boerger | Feb 4, 2007 11:06 am | |
| Stanislav Malyshev | Feb 4, 2007 12:18 pm | |
| Steph | Feb 4, 2007 12:29 pm | |
| Stefan Walk | Feb 4, 2007 12:45 pm | |
| Steph | Feb 4, 2007 12:52 pm | |
| Zeev Suraski | Feb 4, 2007 1:21 pm | |
| Pierre | Feb 4, 2007 1:26 pm | |
| Zeev Suraski | Feb 4, 2007 1:40 pm | |
| Pierre | Feb 4, 2007 1:50 pm | |
| Zeev Suraski | Feb 4, 2007 2:02 pm | |
| Pierre | Feb 4, 2007 2:10 pm | |
| Robert Cummings | Feb 4, 2007 3:11 pm | |
| Sara Golemon | Feb 4, 2007 3:25 pm | |
| Richard Lynch | Feb 4, 2007 8:20 pm | |
| Richard Lynch | Feb 4, 2007 8:22 pm | |
| Richard Lynch | Feb 4, 2007 8:26 pm | |
| Richard Lynch | Feb 4, 2007 8:48 pm | |
| Richard Lynch | Feb 4, 2007 8:52 pm | |
| Richard Lynch | Feb 4, 2007 8:54 pm | |
| Gregory Beaver | Feb 4, 2007 9:13 pm | |
| Brian Moon | Feb 4, 2007 11:29 pm | |
| Antony Dovgal | Feb 4, 2007 11:47 pm | |
| Christian Schneider | Feb 5, 2007 2:20 am | |
| Lukas Kahwe Smith | Feb 5, 2007 2:28 am | |
| Christian Schneider | Feb 5, 2007 2:44 am | |
| LAUPRETRE François (P) | Feb 5, 2007 2:53 am | |
| ivai...@gmail.com | Feb 5, 2007 3:00 am | |
| Ford, Mike | Feb 5, 2007 3:18 am | |
| Ford, Mike | Feb 5, 2007 3:29 am | |
| Richard Quadling | Feb 5, 2007 4:16 am | |
| Ford, Mike | Feb 5, 2007 4:35 am | |
| Christian Schneider | Feb 5, 2007 4:54 am | |
| LAUPRETRE François (P) | Feb 5, 2007 5:37 am | |
| Brian Moon | Feb 5, 2007 9:29 am | |
| Stanislav Malyshev | Feb 5, 2007 10:01 am | |
| Andrei Zmievski | Feb 5, 2007 10:02 am | |
| Stanislav Malyshev | Feb 5, 2007 10:04 am | |
| Andrei Zmievski | Feb 5, 2007 10:06 am | |
| Brian Moon | Feb 5, 2007 10:16 am | |
| Stanislav Malyshev | Feb 5, 2007 10:24 am | |
| Todd Ruth | Feb 5, 2007 10:28 am | |
| Brian Moon | Feb 5, 2007 11:07 am | |
| Andrei Zmievski | Feb 5, 2007 11:17 am | |
| Andrei Zmievski | Feb 5, 2007 11:18 am | |
| Brian Moon | Feb 5, 2007 11:32 am | |
| Robert Cummings | Feb 5, 2007 12:28 pm | |
| Stanislav Malyshev | Feb 5, 2007 12:30 pm | |
| Richard Lynch | Feb 5, 2007 3:30 pm | |
| Richard Lynch | Feb 5, 2007 3:33 pm | |
| Stanislav Malyshev | Feb 5, 2007 3:34 pm | |
| Richard Lynch | Feb 5, 2007 3:36 pm | |
| Richard Lynch | Feb 5, 2007 3:40 pm | |
| Richard Lynch | Feb 5, 2007 3:45 pm | |
| Richard Lynch | Feb 5, 2007 3:54 pm | |
| Mike Robinson | Feb 5, 2007 4:10 pm | |
| Robert Cummings | Feb 5, 2007 4:13 pm | |
| Sara Golemon | Feb 5, 2007 4:20 pm | |
| Edin Kadribasic | Feb 5, 2007 4:21 pm | |
| Ford, Mike | Feb 6, 2007 6:07 am | |
| LAUPRETRE François (P) | Feb 6, 2007 6:16 am | |
| Robert Cummings | Feb 6, 2007 6:41 am | |
| Alain Williams | Feb 6, 2007 6:46 am | |
| Christian Schneider | Feb 6, 2007 7:16 am | |
| Alain Williams | Feb 6, 2007 7:19 am | |
| Tullio Andreatta ML | Feb 6, 2007 7:29 am | |
| Ford, Mike | Feb 6, 2007 7:41 am | |
| Lars Schultz | Feb 6, 2007 7:47 am | |
| Robert Cummings | Feb 6, 2007 8:09 am | |
| Andrei Zmievski | Feb 6, 2007 9:26 am | |
| Andrei Zmievski | Feb 6, 2007 9:27 am | |
| 10 later messages | ||
| Subject: | Re: Syntactic improvement to array | |
|---|---|---|
| From: | Gregory Beaver (gr...@chiaraquartet.net) | |
| Date: | Feb 4, 2007 9:13:08 pm | |
| List: | net.php.lists.internals | |
Andi Gutmans wrote:
Hi,
I thought I may have brought this up a long time ago but couldn't find anything
in the archives.
For a long time already I've been thinking about possibly adding a new syntax
for array(...) which would be shorter. I'd suggest
[...]. While I am usually not in favor of having more than one way to do things,
I think it'd look much more elegant especially (but
not only) for nested arrays.
So what I'm thinking of is: array(1, 2, 3) == [1, 2, 3] array(1, 2, array("foo", "bar")) == [1, 2, ["foo", "bar"]] array("key" => 1, "key2" => 2) == ["key" => 1, "key2" => 2]
$arr = [1, 2, 3] vs. $arr = array(1, 2, 3)
Well enough examples given :)
I think it's not worth doing unless there's overwhelming support as it's not
desperately needed. But I'd be interested to hear
people's thoughts. It seems implementation shouldn't be an issue but I'd have to
dive a bit deeper.
future: <?php $a = [1, 2, 3]; $a[1] = [1]; $a = [1]; [$a] = $a; $a[] = []; echo $a.[1]; // not a parse error ?>
now: <?php $a = array(1, 2, 3); $a[1] = array(1); $a = array(1); list($a) = $a; $a[] = array(); echo $a.[1]; // now a parse error ?>
For what it's worth, the examples above show why I'm a strong -1 on this idea. It introduces the possibility of weird misunderstandings that just don't exist now, and also introduces a new way to accidentally break your script that wasn't possible before.
The only way I could see solving this would be:
1) [] != list() 2) use a[] as in $a = a[1, 2, 3] but then we might as well stick with array().
Either way, [] is overloaded in the new definition:
1) array access 2) ArrayAccess object offsetGet/offsetSet 3) incremental index ($a[] = 1;) 4) array creation [5) list()]
Whereas now, it is only 3 possible meanings, all of which are consistent with a few quirks in the ArrayAccess one as of PHP 5.2.
Greg





