Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130366 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 DF5FC1A00BC for ; Mon, 16 Mar 2026 16:51:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1773679909; bh=r8PO0uhi3O+ULLXqcHczLt0QhtxDu2tokccb1WWLh1w=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=mJHdmczh9SdarFfSpWFSuWB/+AnITYQWnRGWw21m1IEpSbQBKBFYmPTq+ODe4NaLC /K7glZ+aXDbbUaMchGQEdaEFkK/3AJxtUeq9HbmCvvKL3M8YnfdY1Z6eL0Yfo54gSI 35gKkwc6K1d0NLlJRlmXQZ23+i3Rw3vgJZTQNXf9sObjw3pXFzPzZFgo4Jkk5LF70Z +txsdgEyRDQV85qr+NrEK+63g3VqCVhlcG1Wj5Q/prxKJyw4dEJqcjWQp0syZISECs DRY+GcpuP9DgQW02hwrVJiu82TFxNdzJ6PFs3jkiJwCXEnmS5RRJr52I28q3EGeBKr ZvmB7Wh31yYIg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A65E2180086 for ; Mon, 16 Mar 2026 16:51:48 +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=ARC_SIGNED,ARC_VALID,BAYES_50, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (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 16:51:43 +0000 (UTC) Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-8c6f21c2d81so470792385a.2 for ; Mon, 16 Mar 2026 09:51:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773679897; cv=none; d=google.com; s=arc-20240605; b=jiYUU8tZ/UtbP8bRfjuilgGecsglI6iR9xKayWOoHmA1JxcddwKNSfuaFRNgv1mNpU kK1JgKDuRGM+JzMXdHMYW6CadtwoZxF9Xrxu6jeAxoL8brasBCTgtW4PcbxWSPmyVI6r cwnwn/lSeRe1gGX050sOcM3Y/qauCsjbIO9xlfmFq6fGS5H2NbA18+4NKgtaNd3xz/8W 2AgOp10oJid5Um4ovKBy/oXjGJTFOB29wsc09eQWNUBtQydLMRlKN7ldBciG9R6ROx3y pyxbOF+OAKhkbCCRfIW91D2eQHb8fzJywm3cN5yhzHhzGeyXhMmWX4A/F8MiLPZO2RES jk2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=4R98v7BXyW8+ngbe6BIRFjxwygayMqn1wllFyzcTRYA=; fh=jXDcWR1ukxl1xGnLrVs5/HrnkE1RlQTUcTPmdPaNcLo=; b=VvdBFw8+aMSBgIWdr2yQgH47wVrSyWZtHsOh7g/0lnQNQ0KotKHQocdRAzYaFD3Ick R2wP7OVsd5pF/DO4QLj+gGyp82K0IIt109XpYcpWxYD6Tfy5lStGZ/XLzHKEqZTtSEy2 e6wyduT5LputMh/JzT1me6Ie3gRKChtLbP7joR80kHLKChgvxPyS4prM8zTeMhj+uqC7 /bmhiQ81N5mW7vyJNBSEXvafhtU5bse++jDSaF9ZR6YeGKcSMbTja7HulvLrZjw/hI9r 59K/WMo7lZFdYSI5Q3PhhTQFfaB8bLuOYImpcSRNInLwOuIo9LRlPNxofhbmTzlTeDIv pv4w==; darn=lists.php.net ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773679897; x=1774284697; 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=4R98v7BXyW8+ngbe6BIRFjxwygayMqn1wllFyzcTRYA=; b=iu5l2m6enbf1egwfxFeg3aShFubaIyAMkjkYfy4haWna44W9wn9uw7mh7DS61WY+E7 jMSV5i1LI2jQ+JgG9/gk4mIKWaYXA0UtGG1iX14jxUiv41L4KAs3IVH0GFwPtND7xdj8 dCxcRnu520A37d8Y77qoI+XE/ejq6357BQm0G3SrDjnEJ5NIt0vCHTWNV18ikFN5pbvU 81P2erZoX49gaKLB/zJ1/Luzr6ibXZGQUOKL3lWWlfTAgSOMlF6oPmSLt57I/SNeI0N7 D6g5L+0Q54w3EWzeja1IRw2SVDia9h520wCwVRlNp02ELpzas8is+espQT4xf7WE3D38 iL1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773679897; x=1774284697; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=4R98v7BXyW8+ngbe6BIRFjxwygayMqn1wllFyzcTRYA=; b=aS6GpdTLAfNsRMwYVANROP6ye5Mrn51B86F4TnGvn0Z8mIP74GGnIx+XkHFSDvGTiH vxXlmatZRpojYqHy6HchLnqK2lG0fxrII7JCiJus5yMuLlJeQwJAsOJIHdRrrHwykn75 zMPumhGv4Bit2KeVHRL3qA7a7BEXdcV8tbP39EBe7sXyKDux373FxOJWQ/oJ2cXaWHA9 VwuUuj77BUuRnY1pRP9yQWDKFHGhJrgnjyYfWzySpRZSlBAoty03oYfk5tc0TkhtkqfY LK5UEDT4cj2Q8gteG4g2ziOtNNpqgrsD7yzSbCW6WqAeWii5Edk3UbIfYAitOuZ3rQ+J 8fqA== X-Forwarded-Encrypted: i=1; AJvYcCW7QJ/2gpc1WXT/n7PagAM2Ydl3FfU2pcAZkFVPbIizaxXDf8ASfaXfFkQUpgStP3hU1Fyxntb0v0w=@lists.php.net X-Gm-Message-State: AOJu0YzntuTK4IheWdg0drY77fAVIbxXUFQII/Ihx2m3Imx6QJa/EA6m AdgkEFeyKdn01TFs+QtpxsfjSqiWG/Ri4gPCID2PxM8lRT9ygviRiwdfQVeoPH9Fdgh8KBxT5Pb wt1wF9O8BXsHu1TM67GmjJQyb4eK06r400nv2 X-Gm-Gg: ATEYQzzn/j5aq80ihjdmlhUdoVl+6WM8KU7mG7pawz11+9dP3jkSOr4Mi4PPHr08bzv NF4eH0hOAgsAKJLeg5wMM/B+taWYB/oOAnhYtwMNlZuampFATWS8k34CaW8Fk7XsxV3CUioBzaI RCohUco2wfLw216QNtuYNo/ydDYSBp+oFtbQzSHLDGhhWvYTccI4sUAlkLEiBPa2qwMTFSvfUgY zIr2v2dcOYqe4WpUsJ4lRKJ0BQcZtKoFkIARtO4ONNuDLx83/ThEuBx4mN2U48qtgspsvaEJu6V /JFcqC9GQLeFDiKGiMxpFNzdDw+h29VfltGUMHxTF4SPtQBz X-Received: by 2002:a05:6214:e8b:b0:89c:59d0:b057 with SMTP id 6a1803df08f44-89c59d0c037mr29910726d6.56.1773679897266; Mon, 16 Mar 2026 09:51:37 -0700 (PDT) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <995ce501-9106-4485-92b0-7bca3002a565@varteg.nz> In-Reply-To: Date: Mon, 16 Mar 2026 17:51:25 +0100 X-Gm-Features: AaiRm50JunVz--KZqxy-yvOzP0gTcIjjt6I6SwRanKbDhc9IEyuMaHs-CxRR0hk Message-ID: Subject: Re: [PHP-DEV] Array arguments for str functions To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= Cc: Morgan , internals@lists.php.net Content-Type: multipart/alternative; boundary="00000000000038cda8064d270827" From: barel.barelon@gmail.com (Barel) --00000000000038cda8064d270827 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 16 Mar 2026 at 15:32, Tim D=C3=BCsterhus wrote: > 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 =3D 'bazinga'; > > $strStartsWithAny =3D \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=C3=BCsterhus > Tim, Morgan Thanks for your comments. I did not realise that this would be easily implemented by using `array_any`. This means that the RFC that I was planning to create is not actually needed Cheers Carlos --00000000000038cda8064d270827 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, 16 Mar 2026 at = 15:32, Tim D=C3=BCsterhus <tim@baste= lstu.be> wrote:
Hi

Am 2026-03-16 01:41, schrieb Morgan:
> For this extension, I'm not sure what the advantages are over simp= le
> function composition (array_any was introduced for exactly this sort o= f
> 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:

=C2=A0 =C2=A0 =C2=A0$str =3D 'bazinga';

=C2=A0 =C2=A0 =C2=A0$strStartsWithAny =3D \array_any(['foo', 'b= ar', '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 ex= tend this to the
other array_* functions once the PFA PR is merged.

Best regards
Tim D=C3=BCsterhus

Tim, Morgan

= Thanks for your comments. I did not realise that this would be easily imple= mented by using `array_any`. This means that the RFC that I was planning to= create is not actually needed

Cheers

Carlos=C2=A0
--00000000000038cda8064d270827--