On Mon, Oct 30, 2023, at 11:17 AM, Ilija Tovilo wrote:
> Hi Robert
>
> On Sun, Oct 29, 2023 at 7:31 PM Robert Landers
> wrote:
>>
>> Hello Internals,
>>
>> We currently have a null coercion operator: ??, but we lack an
>> anti-null coercion operator.
>> ...
>> fn() =>
>> ($_SERVER['HTTP_X_MY_HE
Hi Robert
On Sun, Oct 29, 2023 at 7:31 PM Robert Landers wrote:
>
> Hello Internals,
>
> We currently have a null coercion operator: ??, but we lack an
> anti-null coercion operator.
> ...
> fn() =>
> ($_SERVER['HTTP_X_MY_HEADER'] ?? null)
> ? md5($_SERVER['HTTP_X_MY_HEADER'])
> : null;
> .
On Oct 29, 2023, at 3:23 PM, Robert Landers
mailto:landers.rob...@gmail.com>> wrote:
Because falsy is different than null/non-existent. The closest
equivalent is "array_key_exists" (instead of empty/isset) but this
proposal isn't just applicable to arrays. I run into this pattern of
"if not null
On Sun, Oct 29, 2023 at 8:53 PM Sergii Shymko wrote:
>
>
>
> On Oct 29, 2023, at 1:31 PM, Robert Landers wrote:
>
> Hello Internals,
>
> We currently have a null coercion operator: ??, but we lack an
> anti-null coercion operator.
>
> For example, if I wanted to operate on a header, if-and-only-i
Following the php logic, maybe !??
From: Sergii Shymko
Sent: Sunday, October 29, 2023 4:53:12 PM
To: Robert Landers
Cc: internals
Subject: Re: [PHP-DEV] Discussion - Anti-null coercion
On Oct 29, 2023, at 1:31 PM, Robert Landers
mailto:landers.rob
On Oct 29, 2023, at 1:31 PM, Robert Landers
mailto:landers.rob...@gmail.com>> wrote:
Hello Internals,
We currently have a null coercion operator: ??, but we lack an
anti-null coercion operator.
For example, if I wanted to operate on a header, if-and-only-if it
exists, I'd have to write someth
Hello Internals,
We currently have a null coercion operator: ??, but we lack an
anti-null coercion operator.
For example, if I wanted to operate on a header, if-and-only-if it
exists, I'd have to write something like this one-liner:
fn() =>
($_SERVER['HTTP_X_MY_HEADER'] ?? null)
? md5($_SERV