Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129883 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 68E281A00BC for ; Fri, 23 Jan 2026 10:32:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1769164342; bh=mWH1R6ZKG0jMOdDH2jqojYpZNNlO+xjBtUWaW7Hwtus=; h=References:In-Reply-To:From:Date:Subject:To:From; b=fXu/tf5KVGU0GdDTr9yBlfmgdiA5f5Xor/VzBD3QfxgZS0UzbeN9ih+xN6QoSM1d8 MBkQtlCF1dk+rzm9gDhvliXwPx4q6LBmZXq7h7BQfmbb5dQRWDFOfA84rLWqzd91c4 0TYeE0dehpBt0lMtPusnWvPQgO038J4VSiREus3Xv2FtrtxTYIFdZmp1jnX0R/6/AZ X6Sx9vUbIOGAYCOUfSRzAjePu1Aqn/SD4JDRlC2XS8XNoXQnpOGd4ee/qDnoEGFza5 ztKb5hcfIWMcZSqkCt2qZV3bGsnYikfluvZWTA/21g0yVHf8zKKO0SINqj0p7Y2qFg gAjicMlt3kn8g== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 29964180054 for ; Fri, 23 Jan 2026 10:32:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_50, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 23 Jan 2026 10:32:21 +0000 (UTC) Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4801c731d0aso15819695e9.1 for ; Fri, 23 Jan 2026 02:32:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1769164335; cv=none; d=google.com; s=arc-20240605; b=dPK/JJ0JSqXMMYdQFX/6XSwXN4et9jtMwCIqn8MPkXxCLqz06E+IJM0kFsbjS57SUL 7OQ7267iuZTbNFefznQap7oGtl27t1MGR8hpBdOMCuT4soZh0NDKXZ99IFlZqH1Xx1O5 7XryWGbCsKIahufQKSW9M+FkBy5nL/nccRcJAOe/Ngg/QUHL6WXzAKi5Z3qwNCXVDALt s1rc6acYG+nTP958GqyJ1fOGGHjzQPIUUoqF1G0qFPWwd5O0B7cd79If89tb4uAKhmX9 70vsyUKYWIkkCK6Cd894kxaUpJmfDXiAFZ8rsGdVRL0512RKIUSOOaghjf66Y5X5KmJ7 scqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=mWH1R6ZKG0jMOdDH2jqojYpZNNlO+xjBtUWaW7Hwtus=; fh=PwvV1jWZOR90rDIG/6XexqaHJyAFBTdnFVhsS64qdEQ=; b=AA64MltQpJc7Gx+fcke8p9VbjT2od0HYLY3nGjoAew/jbCOGnTMfAo0pRdSdMlgFol r72KT04ePwMPitI+RcKyNHZ353bajxrR6ri0GAJQk6TWKCqeqgKIp7k1v2K9+qeXp4F8 zZ8BTZ4LIUXLB3Wk/PML1N5tx5PlsTobb31drdIMYevCSDie3qGh/5dDOLHDCVQWbWZ9 2VTPwQ1Tm2FSb6cktIJK+jn3kU7OUhdCOkUh0Mdafl/Lt9UKbGXlxFoLQHreXqauGHJU sqr+QDGSn93de1loB5Cy047RzVNhTXZdfNqUcbK6sBLS3/rU3QwiimnZUwo3T/DUoLpZ Z7gA==; darn=lists.php.net ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769164335; x=1769769135; darn=lists.php.net; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=mWH1R6ZKG0jMOdDH2jqojYpZNNlO+xjBtUWaW7Hwtus=; b=klenPNoRnJTBbLfhamQI0ij1YwCyXiZZjHQldwvZ9G84XYvpMg/K2UC2bRcBgoocGb adREUwC4bGLwh4e1ihmWHWS4gFiDmrHGYjjFcRp+pHVo47SjybUZyEP6Jlg67d34BeY2 G1ZoDjciHHIhkQDU143VhITGSngp7JKoFNrUBfgDbfH7uYlUU6tYBE8dbGLL1KgGmLMn pL0nL+NabLvZFJ2oT125ggztmXzMfScZV8siX740AmHAXWCVXHS2jgg9KbWxxL5y3Srt D7G9lL41PTrknqQc+vZfSH5OY03dCrfq+2gbdg/AbfIRPurK9Q8gcw1RY3+X9DJBym2v Bf7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769164335; x=1769769135; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mWH1R6ZKG0jMOdDH2jqojYpZNNlO+xjBtUWaW7Hwtus=; b=ORfU7lQyXeHKJo01gq1JMz/tqopNR6mCX1FP3DncxkaJStzQ0wKIRv0w2B568Hzi5r nzWB7eNLXJEXcMxUKteGHfXldwBVBYIRj89HhBrDB3aD9igvOREUE8Z6gg2SdlxLa2WT H5zKpFm8ojn83plZjruqXXtChjyLdX6bRW/G+AjwEfLHOpbRnRkfY8UqTy+ruNBKbHTt E1PAtjUEYOJfhT16f/C6U8Ua6z/pdpZXgDCu7JLvICF2a/LAhgYa5MgWa8fh9L+XrrCK rqWM41IOtd7AXAj6pwVxKOhcXUTh6UaKsGQHS0TRb+/0MBubW3CUn3BcLx5hPJogNXWA Vksg== X-Gm-Message-State: AOJu0YzeuARCaiUEf8i/NnRuIp7jmH4zfo9qoIAIsRShgRQakfQuWDyF kiEWf0I7WDZaOoGWgC7nCffEAAQqvk4VXwwZ8N1SptdcHvAtYQRx5Cz+8Ms7KlcbujR3oNYYpkR vME7czJEaAe14upol9nygr2eqGmPWHHdC6Jso X-Gm-Gg: AZuq6aKiTZZZThxpAKEZxVr6trwYfCNyG2WhD0/0WL8XjY+LErNDFopOEOdRHbWk0Ab cm3ClPmYUm47IyBW4KY0kuiqwBRAUHvgxkDYN1HDS0iOsz+dXkV8x96ugwljovSxGMToVHCqpQd PbTE853kjMriM0BypoKrW6R/CdRes1YZn5FPaIvNxB2ocxk/PGuFJ4t5VLTOmrhUpeUkpur/5PP Md812ejM8bDa2zWSFAU72bLZggZdy8122Kjl3QqeHIj9WUfWDRx8l4EAeQ8LeckyyvEaT/8ItO4 tAU= X-Received: by 2002:a05:6000:2892:b0:3ec:db87:e5f4 with SMTP id ffacd0b85a97d-435b92f9522mr1587307f8f.7.1769164335278; Fri, 23 Jan 2026 02:32:15 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <15b6506dc69bd13eceffd36375f83509@bastelstu.be> In-Reply-To: <15b6506dc69bd13eceffd36375f83509@bastelstu.be> Date: Fri, 23 Jan 2026 11:32:04 +0100 X-Gm-Features: AZwV_QhXgmlafAxjX5CbJCfATv8CfLWpZep3EWieN2Zm4uA7QJ6_uj9aRgY0KjM Message-ID: Subject: Re: [PHP-DEV] [RFC] [Discussion] Prefix and Suffix Functions To: PHP internals Content-Type: multipart/alternative; boundary="000000000000c0f25106490bab53" From: barel.barelon@gmail.com (Barel) --000000000000c0f25106490bab53 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 23 Jan 2026 at 09:31, Tim D=C3=BCsterhus wrote: > Hi > > Am 2026-01-22 19:28, schrieb Barel: > > Following a comment by Tim D=C3=BCsterhus (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 =E2=80=9CExact semantics (per function)=E2=80=9D example it wou= ld 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 =E2=80=9Carray_find=E2= =80=9D RFC might > be a good example here: https://wiki.php.net/rfc/array_find > > 2. In the =E2=80=9CBackwards Incompatible Changes=E2=80=9D section: Can y= ou 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 =3D str_prefix_replace("", ?, ?);` > (with suffix_replace being a reverse concat). > > Best regards > Tim D=C3=BCsterhus > Tim, thanks for your suggestions, I updated the RFC Cheers Carlos --000000000000c0f25106490bab53 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, 23 Jan 2026 at 09:31, Tim D=C3=BC= sterhus <tim@bastelstu.be> wr= ote:
Hi

Am 2026-01-22 19:28, schrieb Barel:
> Following a comment by Tim D=C3=BCsterhus (thanks!) and another commen= t 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 function= s
> like str_contains() and str_starts_with()

Thank you. I have given the RFC another look and have some polishing
comments:

1. In the =E2=80=9CExact semantics (per function)=E2=80=9D 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 =E2=80=9C= array_find=E2=80=9D RFC might
be a good example here: https://wiki.php.net/rfc/array_find
2. In the =E2=80=9CBackwards Incompatible Changes=E2=80=9D 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 =3D str_prefix_replace("", = ?, ?);`
(with suffix_replace being a reverse concat).

Best regards
Tim D=C3=BCsterhus

Tim, thanks for your sugge= stions, I updated the RFC

Cheers

Carl= os=C2=A0=C2=A0
--000000000000c0f25106490bab53--