What about a similar construct for checking truth? eg,

  $foo = first_true($bar, $baz, $bang);

returns the value of the first variable that passes the if(isset($var)
&& !empty($var)) test.

On 10/31/05, Ford, Mike <[EMAIL PROTECTED]> wrote:
> On 29 October 2005 22:56, Greg Beaver wrote:
>
> > For an operation as complicated as "use the first variable
> > that exists"
> > I would be most comfortable with:
> >
> > $d = first-existing: $a, $b, $c;
>
> That's a horrible syntax, but a fantastic name for a language construct to do 
> the job.  Even better might be (something like) first_isset($a, $b, $c) which 
> tells you precisely what's happening: you get the first value that passes the 
> isset() test.
>
> I also find the ?? / ??= suggestion very attractive - it would have been my 
> suggestion for a suitable operator.
>
> Cheers!
>
> Mike
>
> ---------------------------------------------------------------------
> Mike Ford,  Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
> Email: [EMAIL PROTECTED]
> Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211
>
>
> To view the terms under which this email is distributed, please go to 
> http://disclaimer.leedsmet.ac.uk/email.htm
>
> --
> 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

Reply via email to