Hello,
I have a suggestion for upcoming PHP6 as it's a major version change. I
suggest a possibility to use this (example):
$host = parse_url('http://someurl.com')['host'];
instead of
$host = parse_url('http://someurl.com');
$host = $host['host'];
Now it returns a syntax error.
Have a nice day,
A
Hello,
You got +1 from me for this idea.
Regards, Dimitar Isusov
Hi Astro,
Am Freitag, den 23.05.2008, 15:35 +0200 schrieb Astro [GTalk]:
[...]
$host = parse_url('http://someurl.com')['host'];
instead of
$host = parse_url('http://someurl.com');
$host = $host['host'];Now it returns a syntax error.
a) write a proposal, b) write a patch for the Zend Engine, c) ask again.
Thanks, Lars
Lars Strojny wrote:
a) write a proposal, b) write a patch for the Zend Engine, c) ask again.
+1 on what Lars said. Not so much on the syntax. That just looks like
a parse error to me.
--
Brian Moon
Senior Developer/Engineer
When you care enough to spend the very least.
http://dealnews.com/
Astro [GTalk] napsal(a):
$host = parse_url('http://someurl.com');
$host = $host['host'];
You can use this:
$host = parse_url('http://someurl.com', PHP_URL_HOST);
I have a suggestion for upcoming PHP6 as it's a major version change. I
suggest a possibility to use this (example):$host = parse_url('http://someurl.com')['host'];
instead of
$host = parse_url('http://someurl.com');
$host = $host['host'];
I can't see any real benefit of this change apart from a WTF factor... its
possible i'm missing something though! Whats the benefit apart from saving a
line of code?
Why not just skip the second line and use $host['host'] instead of copying
it to $host ?
Regards
Marco
Hi Marco,
Am Freitag, den 23.05.2008, 16:51 +0200 schrieb Marco:
I can't see any real benefit of this change apart from a WTF factor...
its possible i'm missing something though! Whats the benefit apart
from saving a line of code?
The fact that this syntactic variant is available and used in a lot of
other popular languages (JavaScript, Ruby, Python) might be an
indicator, that it is helpful. The use-case has been illustrated before
and is still valid, except that for the specific function there was a
better alternative. The use-case is, in short: "a function/method which
reliably returns an array with fixed keys and you want to use a single
key".
cu, Lars
First of all, this was already discussed, search the archives before posting your suggestions.
Second, I still see very little sense in suggestions not supported by patches.
You can add your +/-1 for ever, but it won't be implemented until someone sits down and writes the patch.
And finally, this particular syntax would require us to change arrays to some kind
of resources so that they could be indicated by some unique index
(that's what was made to objects and now they can be referenced as func()->attr).
This apparently means overall source code rewrite only to enable this syntax of doubtful usefulness.
Hello,
I have a suggestion for upcoming PHP6 as it's a major version change. I
suggest a possibility to use this (example):$host = parse_url('http://someurl.com')['host'];
instead of
$host = parse_url('http://someurl.com');
$host = $host['host'];Now it returns a syntax error.
--
Wbr,
Antony Dovgal