Re: [PHP-DEV] [Pre-RFC] Scalar object methods (with a working implementation)
[email protected] (Morgan)
| Newsgroups | php.internals |
|---|---|
| Message-ID | <[email protected]> |
On 2026-06-30 10:32, Michal Kral wrote: > Hi all, > > calling a small, curated set of methods directly on scalar values, e.g. > $str->trim(), (3)->pow(2). There's a complete, tested implementation and > a full write-up (links below); I'd like to surface the strongest > objections before I write the formal RFC. > Larry Garfield has noted that when PFA lands, one would be able to write $s|>trim(?) One already has $s|>trim(...) but the ? syntax would allow $sep|>explode(?, $str) or $str|>explode($sep, ?) whichever seems more appropriate at the time. Probably not helpful for pre-existing functions (just say explode($sep, $string) already), but user functions might be more readable when pronounced this way..