Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130566 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 DA06A1A00BC for ; Sun, 5 Apr 2026 08:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1775376838; bh=B0oh6rIvttQzkZJr3F54b0pD/Qaxa3eK+WLley2h6X8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dv0Xj34UtbnMUAa6KTio+VGOaSRdh8/22xBdKrWI0BOTO14xyXxk/oZnWvcqRomgi 94JeVhqlckAjjRJNBPfSC+rrsg7xTslVZof2vpe3rsU+kldwBLpgx3QsOhKoAw6bCy X344n+Qu2ZGrzf+Qa4TAWDwUO6lPfj7aPsHr9kAfMHrDdHuE3K+8lrhMWan7PrP3a8 il3Lu2PvolTbEUsa6bfWqrPPFGlhZglBsp8d1ejssRf07DGAQR3PnDMe0+jQ1rBe4m P6YwAagu2OSDEXSRvz8TVRKObWYzdKzq9ghVxowbnzp/lfv1A8mMxnTFJBL44Ph0xT SqnksABJMpABQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 442AB18006E for ; Sun, 5 Apr 2026 08:13:57 +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,FREEMAIL_FROM, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from sonic.asd.mail.yahoo.com (sonic-euwe4-0022.asd.mail.yahoo.com [34.2.86.21]) (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, 5 Apr 2026 08:13:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s2048; t=1775376829; bh=B0oh6rIvttQzkZJr3F54b0pD/Qaxa3eK+WLley2h6X8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=eCzbdCAO62pyWtZo0DXxeuoRJZIZOz+DlDZSjYhDKuwZ/CqEBHiI9lqxorwxvJmWGgK/dWfmvMLLp9iQBK9wJFX5v2siOKrj79JMtloRFh6IELPvejTM23x2bO7/GTIEZdABGpTpoxgCVreYgL0COIxNEQUjDrFvMSEEHCBcbFsV+jTEt5cmqg1okcnS0HAdpn30vV/BDW26xkxT8APoK1Nb9nU0X7SCDy2Fg7cs3I/u+tHBMQ+nkL5hQNt4UhjfSfqz5h1UIQupdqWzQOvNBtcrCu8ghBqPg4sZC7HVBM9YR9AW/m1JMuaLedmZZO/wJy+P2xFOf68a9I0KqwJRZQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1775376829; bh=djbRSjyrvZA3vbyaytysPv9u44WCYvjI5cE5MzYzdx3=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=l9sohLBVdJud/h2qmSuQwYZ0MnSn8C3xWYVkEX8eLK31cMfbsCPK8jC+1FhlfvZAbHkLczrYNHAYZVuMUJelSvqoGFXtxBblBDjqQeBkuE8goYCsN0d/b5btm4a004ccGpVHlcMPsLFFeasSSJW1kLoMKkjJKH1buEANXErHAek1F89YxCi/VuGzU06Y3b7pSJvI4XiDaHXRaD6ZJQ0cpto0/y1Wyc9L8i++LzmcVuP1PlihXmJ/QSWrHV/mBF8RoKGooRDMP4Edk3rsa/jUWPj8TLmG4Fc1S2qAsA6DOWY1VHdeHfH60tY08t4rrNETSLGZLAqx2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E11 l8H9HnZHzGTHoQNu5U6wG_BiwPPAp.RI1nSPEHANYDasEXvhVpwMzfvuZjinOzZYx1SP8ds7Pd.N MwI9iXWKuKAf902h4un.ZTYFkd0DiJyVLlgBnyMywPpOek_wROfcQzwpMkHwlTb1XaMHZflXvDv. oQFxLH_lJYxMNf.rxSN1c14W5_1x2bjCXCDIRncMyTfdicqGqk1W2tFf.OOTHnLj_bIX2BqFNc1f F0El66d6e_1W5bvnEpHx7l9qZB9dSczKVEEt.Pp3Af6ylfwkRC.zdySMYonQNrq8ZwmJtVAyed89 lhGogmNnJ8pv8zNZyIIlHXB0BgYYO712h82ANP.R0Kij8qIk0A_s1.KeWQUTyFQhlmnpqoms4viM 9ViR1dnZf9odQd_0prmYDgF5U.cW7aqenGnnxPxyxraQ.vgCwZcPAXNM3aZNVGdAKaaFMPmwNkSh azbFwwXzQXQOLW2oznSg3eh5K0Cu8FLQ6R6ug2evtWdDFpjBim9Sb0NbpqrbJ79LD8KyuYHlvQp1 o3qJo26OUqzq_yGKzWfVFTiykz4j9Hzysm1pyUWrxRVhQTTUrub1m6O9InzdzE8VlEHZGeYzTEl6 2nO1ziLJBISwMyV2cNaHoh045Vbife6YbbkAreBlCTwj6OovkOjpi1auf2DEE2YwKo8QfZQP2xC2 4GxWPgyvCpl.1BWgOKtYk48LvwAEk.FUetHnRbbw525Pb6u.TPHuPoZ1nGID50BqUPHcVFkYGbTB sP7T6nQb5g2mRFQUncot3IB2VfEQyow0aGaCWR.Vrp_P68hBNS2Gd4geH5Q9ASeaOp_q6c.OZ1aS t724j9hULRZNMGeMNPhz16jq3MHriKKofWAFS2jNAc399s7__jU3VB0pFkSlT8Wef1LYsC3FKj0h 1RUnJpqO4CrbHGBwNuw-- X-Sonic-MF: X-Sonic-ID: 7286a26e-e12a-4b20-ba4a-a755d7f48de9 Received: from sonic.gate.mail.ne1.yahoo.com by mail-asdoutdeli-p-cin-euwe4-prod-sonicconsumer-svc-101 with HTTP; Sun, 5 Apr 2026 08:13:49 +0000 Received: from dip22.lsn.ir2.yahoo.com ([87.248.99.31]) by hello (SMTP) with SMTP ID 572c590cfc3739e72c2b7fc177fa2d9a; Sun, 05 Apr 2026 08:13:46 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Message-ID: <1775371239896.1388335648.2022649470@yahoo.de> To: barel.barelon@gmail.com Cc: PHP internals Subject: Re: [PHP-DEV] [RFC] [Discussion] array_get and array_has functions Date: Sun, 05 Apr 2026 08:13:44 +0000 In-Reply-To: References: X-Mailer: Vivaldi Mail User-Agent: Vivaldi Mail/7.9.3970.47 Content-Transfer-Encoding: quoted-printable Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 From: hanskrentel@yahoo.de (Hans Krentel) On Saturday 04 April 2026 16:06:21 (+02:00), Barel wrote: > Hi, >=20 > I would like to open the discussion on my proposal to add two small, > focused array functions for retrieving and checking nested array = elements > using dot notation. >=20 > This is the link to the RFC: > https://wiki.php.net/rfc/array_get_and_array_has >=20 > This is the link to the proposed implementation: > https://github.com/php/php-src/pull/21637 >=20 > Thanks!! Thank you very much! That=E2=80=99s very interesting, so I have to ask = right away: Is there a specific reason to limit this to strings, integers, = and null for arrays, rather than also allowing arrays or iterables? This reminds me of JSON Pointers (RFC 6901), which can usually be easily = mapped as an iterable with string keys, which can then be accessed via the = holder variable, similar to the foreach example you already describe in = your RFC. If these two functions supported passing an array/iterable with the = traversal keys as a second parameter, this would be advantageous, since the= JSON pointer would then not need to be recoded into dot notation, but only= (if not already done) sliced and passed as an array as the second = parameter. That's why I'm asking. Interestingly, JSON Pointer solves the =E2=80=9Cnull problem=E2=80=9D by = prefixing the zero or more reference tokens (keys) with a slash = =E2=80=98/=E2=80=99, and it supports all seven types of JSON values without= limiting itself to just JSON arrays or objects. This is just food for = thought: array_... are clearly array functions, so this = =E2=80=9Crestriction=E2=80=9D is likely intentional. In PHP, however, I can= also imagine iterables that resemble what you=E2=80=99ve already described= in your RFC, and from there it=E2=80=99s not far to the holder object we = see in JSON and JSON Pointer. So please don=E2=80=99t confuse my = =E2=80=9Crequest=E2=80=9D regarding arrays/iterables with the first = parameter; it=E2=80=99s simply about passing the key as a keys, which is a = small improvement over dot notation. With arrays in PHP, users will likely prefer the non-standard, more custom = dot notation, and that=E2=80=99s perfectly fine. I saw many people asking = for this in the early days of Stack Overflow, and if Symfony/Laravel have = it as well, that=E2=80=99s just another strong indication of such a = preference. Thanks again for your RFC --hakre P.S. Work on the RFC documentation for JSON Path finally began in 2020, and= it was published in February 2024. The standard has its roots in PHP and = JavaScript, and perhaps it=E2=80=99s time for PHP to expand its standard = library with such features at the same pace we did with JSON. Your RFC = seems well-suited for this purpose. Thanks again.