# Syntactic improvement to array

- Thread: https://externals.io/message/27840
- Original archive: https://news-web.php.net/php.internals/27840
- Started by Richard Lynch on 2007-02-05T23:55:00+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #27840 — Richard Lynch — 2007-02-05T23:55:00+00:00

URL: https://externals.io/message/27840#27840

More edge cases:

$foo = array(1, 2, 3];
$bar = [1, 2, 3);

Syntax error because it's unbalancedO

Or kosher, because the choice of start/end delimiters should be up to
the user?

Should it match whatever rule is in place for:

if (...){
endif;



-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

---

## #27841 — Mike Robinson — 2007-02-06T00:10:52+00:00

URL: https://externals.io/message/27840#27841 · In reply to: #27840

Richard Lynch wrote:
> More edge cases:
> 
> $foo = array(1, 2, 3];
> $bar = [1, 2, 3);
> 
> Syntax error because it's unbalancedO
> 
> Or kosher, because the choice of start/end delimiters should 
> be up to the user?
> 
> Should it match whatever rule is in place for:
> 
> if (...){
> endif;


echo("foo.inc");
echo "foo.inc";

$foo = array(1,2,3);
$foo = [1,2,3];

echo $foo[0];
echo $foo{0};

$foo = [1,2,3);  // parse error
echo("foo.inc";  // parse error


Come on. This isn't rocket science, even for newcomers.
It certainly isn't worthy of the [awesome] level of analysis it's getting.
Holy smokes.


Best,

Mike Robinson

---

## #27864 — Andrei Zmievski — 2007-02-06T17:28:21+00:00

URL: https://externals.io/message/27840#27864 · In reply to: #27840

Now you're just grandstanding.

-Andrei




> More edge cases:
>
> $foo = array(1, 2, 3];
> $bar = [1, 2, 3);
>
> Syntax error because it's unbalancedO
>
> Or kosher, because the choice of start/end delimiters should be up to
> the user?
>
> Should it match whatever rule is in place for:
>
> if (...){
> endif;
>
>
>
> -- 
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some starving artist.
> http://cdbaby.com/browse/from/lynch
> Yeah, I get a buck. So?

---

## #27867 — Richard Lynch — 2007-02-07T02:38:21+00:00

URL: https://externals.io/message/27840#27867 · In reply to: #27864

Actually, this one was prompted by seeing a bug fix or changelog about
requiring { } and : endif; to match up, rather than accepting
either/or in balance.

Synchronicity that I even saw that item, but there it is.

I would HOPE that they'd have to balance, but if they don't for the
long block syntax instead of braces, maybe they shouldn't.

Once you have two ways to delimit start and end, you ought to nail
down what does or doesn't work.

The Regex thing with < and > for start/end delimiters is also a
counter-example of what other people seem to like.

I prefer not to take things for granted when defining new syntax,
personally.


> Now you're just grandstanding.
>
> -Andrei
>
>
> 
>
> > […]
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
