Re: [RFC] [VOTE] Prefix and Suffix Functions
| From: | Kamil Tekiela | Date: | Fri, 27 Feb 2026 16:55:37 +0000 |
| Subject: | Re: [RFC] [VOTE] Prefix and Suffix Functions | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-130198@lists.php.net to get a copy of this message | ||
On Fri, 27 Feb 2026 at 16:48, Ilija Tovilo <tovilo.ilija@gmail.com> wrote:
>
> On Fri, Feb 27, 2026 at 5:42 PM Bob Weinand <bobwei9@hotmail.com> wrote:
> >
> > Hey Larry,
> >
> > On 27.2.2026 17:32:47, Larry Garfield wrote:
> > > Though I would also question why so many people are voting for $subject-last for the
> > > secondary vote.
> >
> > The two-argument variants are consistent with e.g. addcslashes (one
> > subject operated on with an argument) - so that's perfectly consistent.
> >
> > Then for replacing, you want consistency with str_replace, and
> > preg_replace and such.
>
> Maybe consistently inconsistent. ;) In my opinion, it's much better to
> not keep repeating the same mistake, pick a standard and stick with
> it. Subject-first always works. I wouldn't think many people want to
> internalize the placement of the subject based on the kind of string
> replacement function.
>
> Ilija
I think $subject should be first because these functions align with
other str_prefix_* functions. If the names were inverted, i.e.
str_ensure_prefix, then I would vote for $subject to be last because
str_replace and str_replace_suffix are more aligned.