Re: [RFC] anti-coalescing-operator
| From: | Sara Golemon | Date: | Thu, 24 Oct 2019 23:23:52 +0000 |
| Subject: | Re: [RFC] anti-coalescing-operator | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-107680@lists.php.net to get a copy of this message | ||
On Thu, Oct 24, 2019 at 4:55 PM Ken Stanley <dohpaz@gmail.com> wrote:
> > isset($_SERVER['fname']) &&
> > $user->setName($_SERVER['fname']);
> >
> > Will return boolean.
> >
>
> Just testing the waters: Is there any appetite to have AND and OR behave
more like Pythons operator?
Instead of now:
(a or b) => bool(true) if either of a or b are true
(a and b) => bool(true) is either of a or b are true
Behave as:
(a or b) => Value of a if true, b if a is not true but b is, bool(false)
otherwise.
(a and b) => Value of b if both are true, bool(false) otherwise.
Coincidentally, this change to T_LOGICAL_AND would server OP's purpose.
I'll tell ya, I'm leaning "No" because BC, but at the same time, AND/OR
seem to be underutilized constructs and I *suspect* (having done zero
research), that most existing uses would yield the same result as they do
now.
-Sara