Re: [RFC] [VOTE] Prefix and Suffix Functions
| From: | Larry Garfield | Date: | Fri, 27 Feb 2026 16:32:47 +0000 |
| Subject: | Re: [RFC] [VOTE] Prefix and Suffix Functions | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-130195@lists.php.net to get a copy of this message | ||
On Fri, Feb 27, 2026, at 10:24 AM, Bob Weinand wrote:
> Hey Carlos,
>
> On 27.2.2026 14:31:16, Barel wrote:
>> Hi everyone,
>>
>> This is to announce the opening of the vote for the Prefix and Suffix Functions RFC
>>
>> RFC: https://wiki.php.net/rfc/prefix_suffix_functions
>> Discussion thread:
>> https://news-web.php.net/php.internals/129842
>>
>> The vote will be open for 2 weeks (and a few hours), closing on March
>> 13th at midnight UTC.
>>
>> Cheers
>>
>> Carlos
>
>
> I like this RFC very much. I think every addition to the standard
> library needs to be well considered, but this one definitely crosses
> the bar.
>
> Simple prefix and suffix operations are quite common - especially in
> scripting and manipulation of well-known strings.
>
>
>
> While you certainly can write these with substr, it often either
> duplicates the string for the length or just hardcodes the length, both
> of which are equally ugly.
> Sure, users can write helper functions for these, but I find below a
> certain size, users typically don't.
>
> Thus I think this proposed change will lead to simpler and less
> error-prone code.
I know I personally would use the _ensure_() functions quite frequently in a project of mine. Hence
my yes vote.
Though I would also question why so many people are voting for $subject-last for the secondary vote.
--Larry Garfield