Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130361 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 CA7771A00BC for ; Mon, 16 Mar 2026 00:41:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1773621721; bh=6Q2oM5AvhWjZs2A7UpiaXBqFjbsxRJPS5q65Izp9kr0=; h=Date:From:Subject:To:References:In-Reply-To:From; b=HFN3fKcdginhZb6hBjexNZ4N90RAng5x/v0XeDmA10bpWjG5EZkkDuTnXaCFOfUKE UQhDM9rOCLUUYM8IOFQVhc56YPa0XuZkB+HH+Ct+ClLTyq6KGmMsxmyk79YXhfoWbA tP4KY/UNrFlbYpo5CON4eE+qjTkjLteJ+ZiC8AtlBYkWLd6qQKfwXImbVtyw7rx6HP HNHAVuINHTp3uJ9GKacP0aQFP4LJVM/8DI1rXDJVB/j8PYEywVRXIHsxXqzrfIOoXr pYhy/FibRUERaPVYr2xlAH0KiCG5xKeOsqCKY45R8oUlwvA37ggv+wp/WQMYLuM/hZ fOxMWjggMJldQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5CF2D180037 for ; Mon, 16 Mar 2026 00:41:58 +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.8 required=5.0 tests=BAYES_50,DMARC_MISSING, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from gavin.smtp.mailx.hosts.net.nz (gavin.smtp.mailx.hosts.net.nz [43.245.52.167]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 16 Mar 2026 00:41:47 +0000 (UTC) Received: from 122-57-27-239-adsl.sparkbb.co.nz ([122.57.27.239] helo=[192.168.1.67]) by gavin.smtp.mailx.hosts.net.nz with esmtpsa authed as varteg.nz (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim 4.96) (envelope-from ) id 1w1w1Z-006Jio-2f for internals@lists.php.net; Mon, 16 Mar 2026 13:41:37 +1300 Message-ID: <995ce501-9106-4485-92b0-7bca3002a565@varteg.nz> Date: Mon, 16 Mar 2026 13:41:30 +1300 Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] Array arguments for str functions To: internals@lists.php.net References: Content-Language: en-GB In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Hosts-DKIM-Check: none From: Weedpacket@varteg.nz (Morgan) On 2026-03-15 20:20, 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 > can accept an array argument for the |$needle| parameter (apart from > accepting a string as they do now). If an array is passed and the | > $haystack| string contains, starts with or ends with any of the strings > in the array then the functions will return true, otherwise returns false. > > 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. > Before creating the RFC I would like to hear the thoughts of the group, > many thanks in advance > > Cheers > > Carlos The functions were added after it was pointed out that userland implementations tended to result in the information being derived internally and then thrown away, requiring the user to reconstruct it; it made sense to yield that internal information directly. For this extension, I'm not sure what the advantages are over simple function composition (array_any was introduced for exactly this sort of job and is applicable to any function). Or disadvantages (e.g. more complex function signature).