# what happened to that new isset() like language

- Thread: https://externals.io/message/19859
- Original archive: https://news-web.php.net/php.internals/19859
- Started by Ford on 2005-10-31T12:54:32+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #19859 — Ford — 2005-10-31T12:54:32+00:00

URL: https://externals.io/message/19859#19859

> 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

---

## #19861 — Sebastian — 2005-10-31T16:29:41+00:00

URL: https://externals.io/message/19859#19861 · In reply to: #19859

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.


> 
>
> > […]
>
> 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
>
> --
> 
> 
>
>


--



-------------
buddhahead@gmail.com
