On Tue, May 25, 2021 at 11:31 AM Hans Henrik Bergan <divinit...@gmail.com> wrote:
> fwiw this can be implemented in userland, and i bet someone already made a > composer package for it ^^ > Not everyone is interested in doing `$array = new ArrayWrapper($originalArray)` and then breaking all `array` parameters. There are a bunch of different packages and people prefer different packages on top of that. Some packages will have feature X and others will have feature Y, and that makes it even harder to properly use. The downside of having this in PHP will obviously be that it's much less flexible than a userland implementation. I'd be very happy to see it in PHP while I won't even bother looking for array wrappers in userland. On Tue, May 25, 2021 at 12:05 PM someniatko <somenia...@gmail.com> wrote: > There is Pipe Operator RFC existing already, which most probably would > suit your needs. The code you want will look like this: > https://wiki.php.net/rfc/pipe-operator-v2 > > ```php > $array |> array_map($somefunction). > ``` The pipe operator feels like a poor solution while `->` would do exactly what people want. On Tue, May 25, 2021 at 12:05 PM someniatko <somenia...@gmail.com> wrote: > > I was wondering whether $array->map($somefunction) would be possible. > > There is Pipe Operator RFC existing already, which most probably would > suit your needs. The code you want will look like this: > https://wiki.php.net/rfc/pipe-operator-v2 > > ```php > $array |> array_map($somefunction). > ``` > > Best wishes, > someniatko > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > >