Javascript has this now though support isn't widespread.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining

The most similar way to do it in PHP would be ?->

On Fri, Feb 12, 2021 at 1:46 PM Ben Ramsey <b...@benramsey.com> wrote:

> > The => is just a suggestion, other options using existing keywords is:
> > return expr() then output();
> > return expr(): output();
> >
> > I do not know if other languages support something like that.
>
>
> I think it might be a good idea to check other languages to see if they
> support something like this. We could use their examples as points of
> reference for discussing whether to include this functionality in PHP.
>
> Cheers,
> Ben
>
>
>

Reply via email to