It should be a function and not a language construct IMHO. Either ifsetor or
overload the isset statement (which may not be possible within the engine).

If isset called with 1 argument, it returns a boolean, otherwise it returns
the first valid variable.

Instead of:

$localvar = (isset($_REQUEST['globalvar'])) ? $_REQUEST['globalvar'] :
"default value";

This makes perfect sense (to me at least):

$localvar = isset($_REQUEST['globalvar'], "default value 1", ...);

That covers the most common usage of the isset variable. Whether its
possible in the engine is out of my range of knowledge.

Bob Silva

> -----Original Message-----
> From: Edin Kadribasic [mailto:[EMAIL PROTECTED]
> Sent: Saturday, October 29, 2005 4:19 PM
> To: Sebastian
> Cc: internals@lists.php.net
> Subject: Re: [PHP-DEV] what happened to that new isset() like language
> 
> 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.
> >
> > On 10/28/05, James Crumpton <[EMAIL PROTECTED]> wrote:
> >> 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
> >>
> >> --
> >> PHP Internals - PHP Runtime Development Mailing List
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
> >
> > --
> >
> >
> >
> > -------------
> > [EMAIL PROTECTED]
> >
> 
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to