Andi Gutmans wrote:
I don't think it's a matter of giving the engine a try. I think we first need
to make a decision what the best way to go is and then we can discuss
implementation if/what is possible. Once 5.0.0 is out I'm going to have more
time look into this.
What's the word on this?
Some of the names given were:
issetor
ifsetor
ifset
ifnull
coalesce
I'm actually kind of partial to:
$a = $foo || $bar;
$a = $foo || $bar || $xyz || $etc;
Or better yet (or maybe in addition too):
$a['foo'] ||= 'bar'; // if set do nothing, otherwise assign 'bar'
-james
Wow, it'll be just like perl! this is so great.
Andi Gutmans wrote:
I don't think it's a matter of giving the engine a try. I think we first need
to make a decision what the best way to go is and then we can discuss
implementation if/what is possible. Once 5.0.0 is out I'm going to have more
time look into this.What's the word on this?
Some of the names given were:
issetor
ifsetor
ifset
ifnull
coalesceI'm actually kind of partial to:
$a = $foo || $bar;
$a = $foo || $bar || $xyz || $etc;Or better yet (or maybe in addition too):
$a['foo'] ||= 'bar'; // if set do nothing, otherwise assign 'bar'
-james
--
--
If we're going to add a new language construct I believe that it should
be readable and not some perl-like thingie. SQL has coalesce() functions
which returns returns first non-null argument of any number of
arguments. PHP version could return a first set argument:
$lang = coalesce($_COOKIE['lang'], $user_settings['lang'], 'en');
It shouldn't be too difficult to tell what this one does.
Edin
Sebastian wrote:
Wow, it'll be just like perl! this is so great.
Andi Gutmans wrote:
I don't think it's a matter of giving the engine a try. I think we first need
to make a decision what the best way to go is and then we can discuss
implementation if/what is possible. Once 5.0.0 is out I'm going to have more
time look into this.What's the word on this?
Some of the names given were:
issetor
ifsetor
ifset
ifnull
coalesceI'm actually kind of partial to:
$a = $foo || $bar;
$a = $foo || $bar || $xyz || $etc;Or better yet (or maybe in addition too):
$a['foo'] ||= 'bar'; // if set do nothing, otherwise assign 'bar'
-james
--
--
Hello Edin,
on the other hand it is not doable....not without a major slowdown.
Thus the idea of ifsetor($var, <expression>).
Why the hell do we need to discuss this over and over again?
The only way is this version. Be it with some cryptic operator like
'?:' or some function name like 'ifsetor'. Either way our internals
and the use of compiler compiler tools do not allow other stuff.
And speaking of '?:' we turned that down because it does suggest
'$a ? $a : <expr>' which is different from the functionality we
actually want: 'isset($a) ? $a : <expr>'. And actually 'ifsetor'
was only turned down because someone very very hard tried to find a
way to turn it down and could only come up with saying its name is
bad. Which i obviously absolutley disagree since its name is
perfectly clear and does not lead to confusion. Becuase it suggests
something like "IF something isSET than take it OR use the other".
regards
marcus
Sunday, October 30, 2005, 1:18:53 AM, you wrote:
If we're going to add a new language construct I believe that it should
be readable and not some perl-like thingie. SQL has coalesce() functions
which returns returns first non-null argument of any number of
arguments. PHP version could return a first set argument:
$lang = coalesce($_COOKIE['lang'], $user_settings['lang'], 'en');
It shouldn't be too difficult to tell what this one does.
Edin
Sebastian wrote:
Wow, it'll be just like perl! this is so great.
Andi Gutmans wrote:
I don't think it's a matter of giving the engine a try. I think we first need
to make a decision what the best way to go is and then we can discuss
implementation if/what is possible. Once 5.0.0 is out I'm going to have more
time look into this.What's the word on this?
Some of the names given were:
issetor
ifsetor
ifset
ifnull
coalesceI'm actually kind of partial to:
$a = $foo || $bar;
$a = $foo || $bar || $xyz || $etc;Or better yet (or maybe in addition too):
$a['foo'] ||= 'bar'; // if set do nothing, otherwise assign 'bar'
-james
--
--
Best regards,
Marcus