Re: what happened to that new isset() like language

From: Date: Mon, 31 Oct 2005 16:29:41 +0000
Subject: Re: what happened to that new isset() like language
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-19861@lists.php.net to get a copy of this message
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 <M.Ford@leedsmet.ac.uk> 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: m.ford@leedsmet.ac.uk > 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 > > -- ------------- buddhahead@gmail.com

« previous php.internals (#19861) next »