On Wed, 23 Feb 2022 at 14:00, Guilliam Xavier
wrote:
> On Tue, Feb 22, 2022 at 3:59 AM Alexandru Pătrănescu
> wrote:
> > But when types are not considered important I think it's worth pursuing
> > extending the coercion from null to the 4 other types where it's
> happening
> > right now:
> > -
>Hi,
>
>In PHP, you can write `$array['a']['b']['c'] ?? 'default';`. It works when
>either null or inexistant index is encountered at any depth of the expression.
>
>—Claude
You're right, I did not know that. Thank you.
That basically replaces the need for my proposal, then.
Regards,
Mel
--
> Le 27 févr. 2022 à 18:06, Robert Landers a écrit :
>
>> $val = $array[?'a'][?'b'][?'c'] ?? 'default';
>>
>> Currently, the last example would need to be a rather unwieldy ternary:
>>
>> $val = (isset($array['a']) && isset($array['a']['b']) &&
>> isset($array['a']['b']['c']) ?
On Sat, 1 Jan 2022 at 23:17, Craig Francis wrote:
> Draft RFC:
> https://wiki.php.net/rfc/allow_null
>
To get a better idea on how I should progress this RFC, I've created a
simple quiz (well, modified an old script).
This is to decide if my RFC should either - continue to allow NULL to be
On Sun, Feb 27, 2022 at 10:59 AM Mel Dafert wrote:
> On 27 February 2022 00:04:58 CET, Kamil Tekiela
> wrote:
> >I just wanted to add that the following
> >
> >$name = $_POST['name'] ?: 'Default Name';
> >
> >with existence check would be
> >
> >$name = $_POST['name'] ?? null ?: 'Default Name';
On Sun, Feb 27, 2022, at 9:11 AM, Robert Landers wrote:
> On Sun, Feb 27, 2022 at 12:35 PM Mark Randall wrote:
>
>> On 27/02/2022 09:12, Robert Landers wrote:
>> > I'd also venture that this warning has caused more harm than good, in
>> that
>> > writing "$var['something'] ?? null" is second
On Fri, Feb 25, 2022, at 4:57 PM, DANIEL VARGAS MUCCILLO wrote:
> Hi Internals, hope you are all well.
>
> I've been playing around with Attributes and found that the only
> way for safely type hint for reflection entities who implement the
> getAttributes method is the following union:
>
>
On Sun, Feb 27, 2022 at 12:35 PM Mark Randall wrote:
> On 27/02/2022 09:12, Robert Landers wrote:
> > I'd also venture that this warning has caused more harm than good, in
> that
> > writing "$var['something'] ?? null" is second nature when writing new
> > code, even if there is practically no
On 27/02/2022 09:12, Robert Landers wrote:
I'd also venture that this warning has caused more harm than good, in that
writing "$var['something'] ?? null" is second nature when writing new
code, even if there is practically no chance for a non-existent key.
Using null coalesce should only be
On 27 February 2022 00:04:58 CET, Kamil Tekiela wrote:
>I just wanted to add that the following
>
>$name = $_POST['name'] ?: 'Default Name';
>
>with existence check would be
>
>$name = $_POST['name'] ?? null ?: 'Default Name';
>
>You don't need empty().
>
>I would be against changing the
On Sun, Feb 27, 2022 at 12:10 AM Mark Randall wrote:
> On 26/02/2022 22:34, Robert Landers wrote:
> > This is not semantically the same though. A $_POST of a form, for
> example,
> > will usually contain an empty value if the form input was empty, but
> > missing if the form control wasn't in
>
> I would be against changing the behaviour of elvis/ternary operator.
> However, I remember seeing past suggestions to implement another operator.
> One that would fill the gap between null-coalesce and elvis operators. If I
> recall correctly, most of the time, these proposals end in consensus
12 matches
Mail list logo