Hi
Am 2026-01-22 19:28, schrieb Barel:
Following a comment by Tim Düsterhus (thanks!) and another comment in
the
PR, I have inverted the order of the parameters in the ensure and
remove
functions, so that they follow the parameter order in related functions
like str_contains() and str_starts_with()
Thank you. I have given the RFC another look and have some polishing
comments:
1. In the “Exact semantics (per function)” example it would probably be
easier to understand if you would provide a userland implementation.
Folks are already used to reading PHP and there is no ambiguity about
the proposed behavior then. As a benefit, the implementation from the
RFC would directly be usable as a polyfill, e.g. for use in
https://github.com/symfony/polyfill. The previous “array_find” RFC might
be a good example here: https://wiki.php.net/rfc/array_find
2. In the “Backwards Incompatible Changes” section: Can you please
perform some research for a rough number estimation? e.g. using GitHub's
code search.
------
Another thing I realized is the interaction between the `_replace`
functions and PFA: It can be used as an (inefficient?) way of creating a
concat as a function handle: `$concat = str_prefix_replace("", ?, ?);`
(with suffix_replace being a reverse concat).
Best regards
Tim Düsterhus