Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127743 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 DBCB61A00BC for ; Tue, 24 Jun 2025 08:18:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1750752982; bh=cYKJRQ0CUyXS+6yrA2wwD8NSjCRlSuOdoEwT+jLkyhk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=O5y8lt59UgmW6J4Fjb/Fu8n1jEvfJuKit+ugN1Ioo8PDS9wVCNe2MU1giaN+04RL9 CHzilo8zpiq3tNlvx03S3+33bkhAXG1Cd+iAqqj+ZGN1HPHdokvQPic5typ+uq8b4+ tszoEqrWDpzhNCg2KppJr2sKBhzsvFLX0ryY/Cme+5R/I710XKlHPEQCRSLWNXtMKO /e1hvz5W7KNtN+/gKTpXKbZOKZ9W0Ecj3q5ZOA4G2r+UgQ3ot1jSTJ/LsZPc8GeSDJ eb1DvdBP3sGdN0HUQHk1LQp9eX/kEo/6QHbH9xmaY2CaQzLHQQCl8+trSkVI7A/Nx2 1p9aps/ox5bKQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0810318063F for ; Tue, 24 Jun 2025 08:16: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.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS 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 mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.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 ; Tue, 24 Jun 2025 08:16:21 +0000 (UTC) Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-ad572ba1347so825019366b.1 for ; Tue, 24 Jun 2025 01:18:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750753096; x=1751357896; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Jz4YKwjE19y7OlFlxSX+Ahkq2fWCPchVMaEj6pFqqNo=; b=FN6q8qNghALrxALT56Njn1lTlpfuApKcuneMKOuZ87/RlnMXYGNLIJtmpEK/z9Wcy8 32z0wt0cbzUaFD30Ts+us/IrUNFXz3mkSx1ZVVbOjTlX/YaqKivH8KtcYeq4DlZW4orj 2hUcXtcyoD3H1Y+QXC1a0Qtc7E2/GZL9q7cNWDSvaFmS2jg0YCpJDcdd6zpLtMxpODrS wN0uiko8uhKnPHxrz7zSZQeFaX8cEPacM2WRIKvEzeyyj+nqUyh3kpo5oq/dZKllq6JV 6mLGY5nJaQvZAQ2MZMvdz2onEZEi1rxoiGKGgn1Kx6mCtRboe8Vo3/Mx4ufV+18Hv5lU MBbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750753096; x=1751357896; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Jz4YKwjE19y7OlFlxSX+Ahkq2fWCPchVMaEj6pFqqNo=; b=JVbbKLdjUzqYO6AF/tFh28M2WbxEp0IsHfitiZYrUqztU3ckERLiOKZqCrAmnKumVL rcBSNWL/rzvm8qvoznauANc7s9enqk41WCbE61IJBzFDPRgyi4+Sf3KKYWGDeTgHfrBW 07MEjyTA+XcblLELRz044FAzxHD2DgaZ2431T06s6QmbVftxyhoKXBEcBdxuUbJF911r Bub4TRjd/pnrQLvEs1rVUNliGrbz0Z8lHvA1PdUoZX07IeQzzgwukzkJlmPy/kmLM08Z kIjUoFzD6iUZQODMhfE8QWw+kJRPhj4dviC2rfcLNu4vszXqbKcExDjc4jsu17903JZh +lqg== X-Gm-Message-State: AOJu0YwyZEMx14BqArEp6oXCgBKyhR+KOExHwBY0J1yZQSC++e9vC+4q pv6fdjHk+7UlNbAxV9mziZPTxj68Lp56FPp7PInUz2nEQjy1Uj2an5MDfxgc7a2JnqJ0AILHhx7 PIv5dkAq9rIojyeFjyBBalVzHTa3QEHW5HHk7 X-Gm-Gg: ASbGncuk5P0NY+4ltW8eDNNut9iUe81VCxk2/2hOe7UwiRcsFblHiyoIpYG5jR7dcFs ptGx4Wrms+HASErQVAbciPmdVkR/hwZWTCIvYg32KAzZulXOJ6/VQaiPjuiKltUzDYbx4xd8v1q Dj36zZRCGV5b1Sl9nkcxZnxUGyo2FNQIkgaF/cymD3H3Y= X-Google-Smtp-Source: AGHT+IEyZ8kQKqIW/FlyDNb2xgvgK52uohttsTOMSTLTzyon8oRyOw2hsYxj8gBp6xjWHMxdKWOWP8K9A3hf41b+5Lg= X-Received: by 2002:a17:906:fd83:b0:ade:3b84:8ef6 with SMTP id a640c23a62f3a-ae057abdef2mr1497942366b.23.1750753096156; Tue, 24 Jun 2025 01:18:16 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <69ee9492-f7eb-4287-b222-41682ee41879@app.fastmail.com> In-Reply-To: <69ee9492-f7eb-4287-b222-41682ee41879@app.fastmail.com> Date: Tue, 24 Jun 2025 09:18:03 +0100 X-Gm-Features: Ac12FXyy677IKPXYFzJR7U3Pa4aPLsHsrN2dgj0wblIPgEO4nW1OFA0e-pnQHqU Message-ID: Subject: Re: [PHP-DEV] [RFC] str_icontains To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="00000000000062cd4a06384cf8c4" From: adamcable@gmail.com (Adam Cable) --00000000000062cd4a06384cf8c4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 > > friend of str_contains > > > > RFC: https://wiki.php.net/rfc/str_icontains > > PR (including tests): https://github.com/php/php-src/pull/18705 > > > > Previous discussion: https://externals.io/message/127504 > > > > Thanks, > > Adam > > When str_contains() was added, a case-insensitive version was deliberatel= y > omitted in favor of "just use strtolower() yourself." Have you gone back > to see the arguments for that to determine if they're still relevant? > > (I don't recall the details; I think one of them was function count > explosion, but I think there were more.) > > --Larry Garfield > Thanks Larry. Yes, I did spend time reading through the past discussions on both str_contains and the str_starts/end_with functions. I think initial RFCs failed because (a) people felt that the functions didn't necessarily bring a whole heap of functionality above userland code and (b) the debate about whether case-insensitive versions should be included. Now that these functions exist, it seems weird as a PHP user that case-insensitive versions aren't available to easily switch between. Obviously we have the UTF-8 question that I've detailed, but I'm hoping adding this will solve a tiny issue where people expect this function to exist, but it doesn't. Adam --00000000000062cd4a06384cf8c4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Tue, Jun 24,= 2025 at 12:20=E2=80=AFAM Larry Garfield <larry@garfieldtech.com> wrote:
On Sun, Jun 15, 2025, at 3:12 PM, Adam Ca= ble wrote:
> Hello internals,
>
> I'd like to present my first RFC - str_icontains, a case-insensiti= ve
> friend of str_contains
>
> RFC: https://wiki.php.net/rfc/str_icontains
> PR (including tests): https://github.com/php/php-src/p= ull/18705
>
> Previous discussion: https://externals.io/message/127504=
>
> Thanks,
> Adam

When str_contains() was added, a case-insensitive version was deliberately = omitted in favor of "just use strtolower() yourself."=C2=A0 Have = you gone back to see the arguments for that to determine if they're sti= ll relevant?

(I don't recall the details; I think one of them was function count exp= losion, but I think there were more.)

--Larry Garfield

Thanks Larry.

Yes, I did spend time reading through the past discussions= on both str_contains and the=C2=A0str_starts/end_with functions.
I think initial RFCs failed because (a) people felt that the functions did= n't necessarily bring a whole heap of functionality above userland code= and (b) the debate about whether case-insensitive versions should be inclu= ded.

Now that these functions exist, it seems weir= d as a PHP user that case-insensitive versions aren't available to easi= ly switch between.
Obviously we have the UTF-8 question that I= 9;ve detailed, but I'm hoping adding this will solve a tiny issue where= people expect this function to exist, but it doesn't.

Adam


--00000000000062cd4a06384cf8c4--