Re: Implicit isset in ternary operator
| From: | Ferenc Kovacs | Date: | Fri, 24 Aug 2012 21:15:30 +0000 |
| Subject: | Re: Implicit isset in ternary operator | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-62461@lists.php.net to get a copy of this message | ||
On Fri, Aug 3, 2012 at 12:26 AM, Alex Aulbach <alex.aulbach@gmail.com>wrote:
> 2012/8/2 Andrew Faulds <ajf@ajf.me>:
> > Hi,
> >
> > Also in JavaScript if in strict mode. Legacy non-strict mode JS doesn't
> cause an error though.
> >
> > JS's || operator supresses this error though, which is great for e.g. x
> = x || new Object();
>
> Could be cool to make this in PHP with the 'or' operator (or not ||)...
> Which brings us back to the subject...
>
> --
> Alex Aulbach
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
most/some of the ideas here were brought up before, there is a proposal and
a nice history of mailing list discussions (albeit not up-to-date) at
https://wiki.php.net/rfc/ifsetor
personally I would really like an ifsetor/coelesce kind of language
construct.
accepts any number of arguments, won't trigger notice on unset variables,
and returns the first non-null argument.
--
Ferenc Kovács
@Tyr43l - http://tyrael.hu