Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130363 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 8BC0D1A00BC for ; Mon, 16 Mar 2026 14:30:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1773671425; bh=K2rs0P2JLkCoG1S0h4xkGh6bRt4OIrLHT5pwWViGkL0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=bYX9pP4VEM0bO4srWy08RVfD6biJb7FfMx2RXXIDZrDKG1K8gCKHrk0/OEwX/Kjzl hDXCkHLsKGUTL5GXZfRYI+HS5M0gNYvy7aPiKjEv2QAE0nnDZ0RK5eH4T4ZWl3e/p8 PC6U5lVybXumKTTsbWhd5ABGnBzADhXj2ob01bV2Ymht64sD1P35ir70ER4PJ+nkjW CxGvbsGxJji+P/qt9NbjJUvHkqo2qnPhBMp5H1iDW7U6Y7V7pZZgRXQvvcPxMCmd6q 2cGOEuhU1cL36PchCjmXs/82pkULBxhQKcDoEsjXR7IjzFJBQTvbj9XrtL5ke5jkdp 6oQnBjKFXJy2w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5F6F41801D8 for ; Mon, 16 Mar 2026 14:30:20 +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 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 ; Mon, 16 Mar 2026 14:30:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1773671413; bh=a+/QNDYOgdVLsOx2yIOlN0gvxTDbndmREA4/NqwRw9Y=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=HEZ9ee8Hmwzi1x9VjdYEfPWRozsur5a6XWvIzmPIljmZ4AzYzstreV2Sh3TuTymUl vIulbuqmhGJ5Dc9nourOvhK1AqfrlTPlWr4KlRbuvz7XWG7duOHoO8H7iZxEBHDECw dxJixs/PHKeHuwNX+3FrgZCCoA92PrX2ATZiaHjssCqJUP/+uDU7IlLEcRgMEquwZo DU5r5tX5ghbma/99kLz53tqfHJnrWMyUJfPYzEdtu3147QHQGljKG4J+xIrRSZ9jqF wcNAqrDIuCicTGlxekqKXwUk99eHGFgdm8886fBTp9ppWH1f1k0Um7ciBUdQ3la8mE 7sWEcieiNgiAw== Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Date: Mon, 16 Mar 2026 15:30:11 +0100 To: Morgan Cc: internals@lists.php.net Subject: Re: [PHP-DEV] Array arguments for str functions In-Reply-To: <995ce501-9106-4485-92b0-7bca3002a565@varteg.nz> References: <995ce501-9106-4485-92b0-7bca3002a565@varteg.nz> Message-ID: 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-03-16 01:41, schrieb Morgan: > 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) I agree. Especially since the Partial Function Application RFC was accepted an ad-hoc implementation would just be: $str = 'bazinga'; $strStartsWithAny = \array_any(['foo', 'bar', 'baz'], \str_starts_with($str, ?)); I have also added an optimization to PHP 8.6 that compiles `array_map()` into a foreach loop when the callback is first class callable or PFA: https://github.com/php/php-src/pull/20934. I plan to extend this to the other array_* functions once the PFA PR is merged. Best regards Tim Düsterhus