Re: [RFC] [Discussion] Prefix and Suffix Functions

From: Date: Fri, 06 Feb 2026 10:19:53 +0000
Subject: Re: [RFC] [Discussion] Prefix and Suffix Functions
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-130026@lists.php.net to get a copy of this message
On Fri, 6 Feb 2026 at 10:53, Ilija Tovilo <tovilo.ilija@gmail.com> wrote: > Hi Carlos > > On Fri, Feb 6, 2026 at 10:41 AM Barel <barel.barelon@gmail.com> wrote: > > > > It's been 14 days since the last change to the RFC and there have been > no further discussions, so the cooldown period is over and I would like to > announce the start of the voting > > > > Link to the RFC for reference: > https://wiki.php.net/rfc/prefix_suffix_functions > > Sorry for my late feedback. > > What's the rationale for $subject being the last parameter only in > str_prefix_replace() and str_suffix_replace()? I feel pretty strongly > that the subject should always be the first parameter. We don't want > to add to the classic haystack/needle confusion. > > Regards, > Ilija > Hi Ilija These new functions follow the format of their closest existing relatives, thus the _ensure and _remove functions follow the format of the str_starts_with, str_ends_with and str_contains functions where the subject is the first parameter, while the _replace functions follow the format of the str_replace and preg_replace functions where the subject is the last parameter. It is unfortunate that these two groups of functions follow different standards but I thought it would be better to keep as close to existing functions as possible Cheers Carlos

« previous php.internals (#130026) next »