Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127745 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 AAC951A00BC for ; Tue, 24 Jun 2025 13:30:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1750771735; bh=a+LKfaXX8Jk5vpDIdNTiem8rUXlr0bRsAUuoFe1ENhE=; h=Date:From:To:Subject:In-Reply-To:References:From; b=bCP08Kw+3bosdBHNFt9mrNdxkuiY6B5/UzQoUAGy7bUWPK9rJHHOKOa2E4jg5IUlq KGW4IFD+GtFoO9nRhfgA+u0j5Aw2y961leLIXOpX8VZY6svwKuGChlpnQbzEt3wdFm RJ+RYVhusEdLF9UtsorKKkOsuuE1N3bkkAsxdr5dI5wEdDU5IIvJOq53W29t9fRBfc I/MAZAX9dCB7yOv4YLnHeT7H9lCCWGH/mn2ix7e2knrfYPipgXnA5+5k7qz2pccl2R Qa66bp2HGWfLt+UMQm2KQiObUaeYtQzGpMJDsnQuRwu4Hvu7V7rHOiRPYimYNivS6Z x8YxdFHMrbDKQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E5465180394 for ; Tue, 24 Jun 2025 13:28:54 +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=3.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_PASS, SPF_SOFTFAIL autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from xdebug.org (xdebug.org [82.113.146.227]) (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 ; Tue, 24 Jun 2025 13:28:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1750771849; bh=a+LKfaXX8Jk5vpDIdNTiem8rUXlr0bRsAUuoFe1ENhE=; h=Date:From:To:Subject:In-Reply-To:References:From; b=P7OdWd0RuDbBY/iaDWDKOQZgNniFhQJAlC9BCCJuVQQsukaTWR5+3Dw++KBMMD4By ZWJpBWnIlD/sq6PL9xeGRmXPabAlUSE1pHNsv9i/LDv9Fxt8LVfhEldLSXK1HrNGgZ UnHLo62TDS13WDW/7WKlSMsTYMTC4duNEPZ76jfeVoJvJ7K9pqfMQjwXMj/flJLmjt OfKJ+HNkNfoMV0JCGCX8epSWNV3GIe+//WkzszzemxtoLybqJXxRFPJYFpt81Of3Z+ OBcAEi9JBnhjLkqS38rGYvNo1BvLAvyD+H4EwKG4XgJ7g3VPovp1KmKPjvh4WrQFrL ftckgxRDHfljA== Received: from [127.0.0.1] (unknown [148.252.146.89]) by xdebug.org (Postfix) with ESMTPSA id BFF5D10C04F; Tue, 24 Jun 2025 14:30:48 +0100 (BST) Date: Tue, 24 Jun 2025 14:30:47 +0100 To: internals@lists.php.net, Larry Garfield , php internals Subject: Re: [PHP-DEV] [RFC] str_icontains User-Agent: K-9 Mail for Android In-Reply-To: <6da22e12-3db2-4880-b045-6eaf68f2a24a@app.fastmail.com> References: <69ee9492-f7eb-4287-b222-41682ee41879@app.fastmail.com> <6da22e12-3db2-4880-b045-6eaf68f2a24a@app.fastmail.com> Message-ID: <2A7316E2-C256-4214-B74C-892B10573C2A@php.net> Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: derick@php.net (Derick Rethans) On 24 June 2025 14:13:16 BST, Larry Garfield wro= te: >On Tue, Jun 24, 2025, at 3:18 AM, Adam Cable wrote: >> On Tue, Jun 24, 2025 at 12:20=E2=80=AFAM Larry Garfield wrote: >>> On Sun, Jun 15, 2025, at 3:12 PM, Adam Cable wrote: >>> > Hello internals, >>> > >>> > I'd like to present my first RFC - str_icontains, a case-insensitive= =20 >>> > friend of str_contains >>> > >>> > RFC: https://wiki=2Ephp=2Enet/rfc/str_icontains >>> > PR (including tests): https://github=2Ecom/php/php-src/pull/18705 >>> > >>> > Previous discussion: https://externals=2Eio/message/127504 >>> > >>> > Thanks, >>> > Adam >>>=20 >>> When str_contains() was added, a case-insensitive version was delibera= tely omitted in favor of "just use strtolower() yourself=2E" Have you gone= back to see the arguments for that to determine if they're still relevant? >>>=20 >>> (I don't recall the details; I think one of them was function count ex= plosion, but I think there were more=2E) >>>=20 >>> --Larry Garfield >> >> Thanks Larry=2E >> >> Yes, I did spend time reading through the past discussions on both=20 >> str_contains and the str_starts/end_with functions=2E >> I think initial RFCs failed because (a) people felt that the functions= =20 >> didn't necessarily bring a whole heap of functionality above userland= =20 >> code and (b) the debate about whether case-insensitive versions should= =20 >> be included=2E >> >> Now that these functions exist, it seems weird as a PHP user that=20 >> case-insensitive versions aren't available to easily switch between=2E >> Obviously we have the UTF-8 question that I've detailed, but I'm hoping= =20 >> adding this will solve a tiny issue where people expect this function= =20 >> to exist, but it doesn't=2E >> >> Adam > >A discussion of that, and why you think the new position outweighs the or= iginal decision, should be included in the RFC=2E > >(At the moment I'm undecided; yeah it's an easy enough utility to add, bu= t the UTF-8 issue is real, and one could easily argue that it's stripos() t= hat's wrong, because it's misleading as it only works on ASCII=2E) > >The ideal answer would be Derick's built-in String object RFC, which I do= n't think has been touched in a while, sadly=2E=2E=2E > >--Larry Garfield That lives here, and ought to work fine as an extension for PHP 8=2E3+: It works on graphemes, groups of Unicode code points that make up a letter= =2E It also handles strings in multiple locales=2E It doesn't yet have a contains method=2E cheers Derick