Re: [PHP-DEV] PHP7 Coalesce operator

2015-11-23 Thread Andrea Faulds
Hi, shadda wrote: That’s not a bad idea, but it’s still limited in certain cases, where your list of possibles is, lets say, complex. At this point, I think you guys get what I’m after, and I’m wondering if anyone else finds the idea as useful I as do. In fact, if it didn’t break the One Law

Re: [PHP-DEV] PHP7 Coalesce operator

2015-11-23 Thread shadda
That’s not a bad idea, but it’s still limited in certain cases, where your list of possibles is, lets say, complex. At this point, I think you guys get what I’m after, and I’m wondering if anyone else finds the idea as useful I as do. In fact, if it didn’t break the One Law of PHP (thou shalt n

Re: [PHP-DEV] PHP7 Coalesce operator

2015-11-23 Thread Ryan Pallas
Well use null coalesce + elvis together then? // Coalesce possible null values, and use truthy comparison in elvis to "coalesce" to a default $var = ($_GET['possible_value'] ?? $_COOKIE['secondary'] ?? false) ?: DEFAULTS['var']; On Mon, Nov 23, 2015 at 1:16 PM, shadda wrote: > It’s not hate, I

Re: [PHP-DEV] PHP7 Coalesce operator

2015-11-23 Thread shadda
It’s not hate, I happen to like that ?? was added. I’m not raising a concern nor asking for a change in its behavior. Rather, I’m asking for another, similar operator that’s based on truth-evaluation (with PHP’s tender, loving conversion rules baked in), in *addition* to ?? which tests for null/

Re: [PHP-DEV] PHP7 Coalesce operator

2015-11-23 Thread shadda
Oh, please, by no means take that as an endorsement for dropping error reporting levels. It was just an observation of how PHP actually derives a conditional in those situations. It’s not as if there’s a fatality in script execution when you make that kind of comparison, it’s just a really shitt

Re: [PHP-DEV] PHP7 Coalesce operator

2015-11-23 Thread Phil Sturgeon
On Mon, Nov 23, 2015 at 9:52 AM, shadda wrote: > Er, that should read, “anything non (null, false, undefined) is true” > >> On Nov 23, 2015, at 11:51 AM, shadda wrote: >> >> Hey, thanks for responding. >> >> However, I still think that misses the point, or at least the true utility >> of what I’

Re: [PHP-DEV] PHP7 Coalesce operator

2015-11-23 Thread Levi Morrison
> In practice, you can ignore E_NOTICE and php will happily treat null and > !isset() as the same thing in *most* cases, so that’s not a good indicator of > truthiness. If you really believe that then this is all you need already: $database = $config['database'] ?: 'db'; Correct? -- PHP

Re: [PHP-DEV] PHP7 Coalesce operator

2015-11-23 Thread shadda
Er, that should read, “anything non (null, false, undefined) is true” > On Nov 23, 2015, at 11:51 AM, shadda wrote: > > Hey, thanks for responding. > > However, I still think that misses the point, or at least the true utility of > what I’m proposing. > > In practice, you can ignore E_NOTICE

Re: [PHP-DEV] PHP7 Coalesce operator

2015-11-23 Thread shadda
Hey, thanks for responding. However, I still think that misses the point, or at least the true utility of what I’m proposing. In practice, you can ignore E_NOTICE and php will happily treat null and !isset() as the same thing in *most* cases, so that’s not a good indicator of truthiness. Bas