[PHP-DEV] Re: [Pre-RFC] Scalar object methods (with a working implementation)
[email protected] (Michal Kral) Sat, 4 Jul 2026 22:35:07 +0200
| Newsgroups | php.internals |
|---|---|
| Message-ID | <[email protected]> |
Hi Morgan, > $sep|>explode(?, $str) > or > $str|>explode($sep, ?) Right, PFA plus the pipe covers a lot of the chaining, and the ? placeholder for argument position is nice. The difference I care about is what the chain binds to. $s |> trim(?) pipes into the global function namespace, so you get whatever trim / mb_trim / str_* happen to be, with their names and argument orders. $s->trim() is a small curated set defined on the type, so it autocompletes and the names stay stable. Different axes, they coexist fine. Pipe's the right tool for a lot of code. The methods just give primitives a small, discoverable surface for the common stuff. Michal