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
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
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
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/
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
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’
> 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
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
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