Re: Unifying logical operators

From: Date: Wed, 11 Jul 2018 07:31:34 +0000
Subject: Re: Unifying logical operators
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-102744@lists.php.net to get a copy of this message
Hi, On Wed, Jul 11, 2018 at 5:20 AM, Ryan <iggyvolz@gmail.com> wrote: > On Tue, Jul 10, 2018 at 2:58 PM, Andrey Andreev <narf@devilix.net> wrote: > >> isset($foo) OR $foo = 'bar'; (and similar variations using empty() >> and/or &&) is another pattern I use often to set fallback values for >> empty or missing inputs. >> >> An eventual deprecation would make literally all of my code output >> entire screens of warnings. >> > > $foo=$foo??"bar"; would work there. I could definitely see this being an > issue if you weren't using isset (although a concrete example of that > doesn't come to mind right away). > I'm very well aware of the alternatives, that's not the point. I and although not a majority, many others too would have to go and replace countless instances of OR usage, for no reason other than "it can be done another way". Aside from a few people asking what the difference is, in more than a decade with PHP, I've never seen a single person who's had a problem with the operators you want to deprecate. They're not a common cause for bugs even by a long shot, nor a common annoyance, so I fail to see the benefits of your proposal. Cheers, Andrey.

« previous php.internals (#102744) next »