Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130320 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 6029A1A00BC for ; Sun, 15 Mar 2026 08:21:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1773562868; bh=w0Afqyywk0CGeb2iBy7h0w6KBy2fbdb7cBZ+keLCtyg=; h=Date:From:To:Subject:In-Reply-To:References:From; b=d3EiGGJZFkiCz/zFIJiwtxhpv0akv7B0lA9FWhUUO2RzTbW7H4v+BSltHX1oFJJvj ufs6Z9gVn9kWkVl7jrKk5cHig64SYhII4XqmPkAnpnFuFEfAfkZ98/J1qtLiB3xX+2 tOE8XHPxWPV43Kzhjm3A3DxR+neZSw9LJ4i/njYCTPJuXtOjV3qv8/XHzQPMV4cyF8 O9KXndGlFQfCeidlPePzb2+FI9+MiYw8DjkP8V/1xGiE67Cljd+4zXBbc5+IcIZ17E KShv7VD80UiiOpp6BaDLY1USjYU85om0bc+S/K0lR9zJEs3VT+oOjW1YcBIrZO0uDs QF5bDLsulFFSg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 63FAA180057 for ; Sun, 15 Mar 2026 08:21:01 +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, T_SPF_TEMPERROR autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail.xdebug.org (mail.xdebug.org [176.126.244.128]) (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 ; Sun, 15 Mar 2026 08:21:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1773562854; bh=w0Afqyywk0CGeb2iBy7h0w6KBy2fbdb7cBZ+keLCtyg=; h=Date:From:To:Subject:In-Reply-To:References:From; b=iddJjKD4bz66lijMlDa7+jMrQMI7m07FBizBaXnHlgMK3SzjyzxwN4fiKO8vfLiOm Rz7c+bBMoLj1jteH+jaQaQqqXzRHVCdvpuBDGQk1jn/l2qstvIJeLyx5QqKum7tMpY nSjAvCZ6vLyab09W74LEls5hDWtLolxjmIqCsQUlUSNFMbn12yM5cRiAEB3TYlDdWu /Es/3IlfYAae8j01Ig1gWFLKxC4heqj2qNNhA79dgLvhR/z5d23JysLSKk4bFuPGOv qZISuFIC2O2kOy7EIxB0A+FIyyWpcVQYwYnViBsOH9BIzH+x2YN6O5ysGRZBTCyZNg AeccrAxvOIM+w== Received: from ehlo.thunderbird.net (2a02-a474-9c40-1-a162-177e-afc8-b8dd.fixed6.kpn.net [IPv6:2a02:a474:9c40:1:a162:177e:afc8:b8dd]) by mail.xdebug.org (Postfix) with ESMTPSA id 5827A200E8; Sun, 15 Mar 2026 08:20:54 +0000 (UTC) Date: Sun, 15 Mar 2026 09:20:53 +0100 To: internals@lists.php.net, Barel , PHP internals Subject: Re: [PHP-DEV] Array arguments for str functions User-Agent: K-9 Mail for Android In-Reply-To: References: Message-ID: <4203ACE0-03F4-457B-A542-C9FC2B72AE98@php.net> Precedence: list list-help: list-unsubscribe: list-post: List-Id: 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 15 March 2026 08:20:38 CET, Barel wrote: >Hi all, > >I would like to create an RFC proposal suggesting modifying the >str_contains, str_starts_with and str_ends_with functions so that they ca= n >accept an array argument for the $needle parameter (apart from accepting = a >string as they do now)=2E If an array is passed and the $haystack string >contains, starts with or ends with any of the strings in the array then t= he >functions will return true, otherwise returns false=2E > >I looked at the RFCs where these functions were added and at the related >internal discussions and could not find any discussion about this >possibility=2E >Before creating the RFC I would like to hear the thoughts of the group, >many thanks in advance > >Cheers > >Carlos The semantics for starts_with and ends_with are easy to argue they should = mean any element, but for str_contains it could be useful to have either al= l, or any=2E I'm therefore thinking it might be better to have separate functions to ma= ke this clear=2E cheers Derick