Remix.run Logo
mg 5 hours ago

When I look at the new pipe syntax ...

    $output = $input
        |> trim(...)
        |> (fn (string $string) => str_replace(' ', '-', $string))
        |> (fn (string $string) => str_replace(['.', '/', '…'], '', $string))
        |> strtolower(...);
... I think why not just something like the following?

    $output = $input
        |> trim($)
        |> str_replace(' ', '-', $)
        |> str_replace(['.', '/', '…'], '', $)
        |> strtolower($);
Epskampie 4 hours ago | parent | next [-]

The three dots in trim(...) make a callable out of a function, that was already in, so seem best to re-use that syntax, at least for now. [1]

As for the partial function application, there is already an RFC to add that, but it's not decided on as of now. [2]

1: https://www.php.net/manual/en/functions.first_class_callable...

2: https://wiki.php.net/rfc/partial_function_application_v2

2WSSd-JzVM 3 hours ago | parent | prev [-]

[dead]