Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129878 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 C31F51A00BC for ; Fri, 23 Jan 2026 08:31:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1769157075; bh=ioGfGUAEv95x1gKGVpO/7KqnSw7ASgpeyW5rXLh+Hxk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=DuV/EQNWQBFCelCe34JbPu6kUC9akV8G8dBkNrdePurBgg1kFxCSwcYjdTBUvJw5V GdY+2u9tKh4dm2TXLcEhola0i0hnYVgTS0Fmd7lfCFpSQjaAiHd8CxAIkzosq6svhO XS6jQdCLFSouhjq+nMbr5zey64WJ1tXQCMuOKR7S4B7Xckt23OHa1heuP63bpCxL7a TIhxwEv5FUhjrD5erCSUYyLsjTaeLfB4l6wLAPmSgdp9UHyyFw8JgLjF3zwCRzp5Th JFOp+R+tjeOVSVP39ZUm2hRR8w3Mf/xWo/18pM87qSIXcqsg3cmUXXLWsgVZGalu2Z d5sRZEDbuMdbw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3E3B5180047 for ; Fri, 23 Jan 2026 08:31:14 +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=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (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 08:31:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1769157067; bh=B/l8iLGhD/HEaH8vnZ+KL2b4U18bkieNYPMh4LHszhs=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=Pw02pN0WKzYDSyP+OzAUAUe4Kc4vrT/AwHn0LAFB7wTBhCl7FxgGiBQVjNZpMUTa+ yeEc4z0IGLjTyZWXEsWk7hTRQ7AML85nntLlFX6rDq3votRTpcMDnqRf//UZz08ClV 5irF4TN8PSBiUcQlB/KhFFKiXL3wQVlIC1xgdqCJ+Ytnqc/s4Jv3QFt19mucfAxP0y aRC1JcJAXhxlL1rOhn2CWf54YzHITPyuRh4gCtyynYnvrcZPTubmifz2FoLbizDHa9 2sHC+4zSkhHGBwf+YRdJrMrtNrIVaaS10spARvJ2HndRU2dmiPqGgu39VEbgav0o4x UZsTa3TnpygPA== Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Date: Fri, 23 Jan 2026 09:31:07 +0100 To: Barel Cc: PHP internals Subject: Re: [PHP-DEV] [RFC] [Discussion] Prefix and Suffix Functions In-Reply-To: References: Message-ID: <15b6506dc69bd13eceffd36375f83509@bastelstu.be> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) 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