Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130625 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 C271E1A00BC for ; Mon, 13 Apr 2026 15:21:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1776093665; bh=VzCn/Qe6N0nC1H37rcF+UmOdQ2ttKsx8ZrlbyzOsGpQ=; h=Date:From:To:In-Reply-To:References:Subject:From; b=PmUdmE672Lmk1kRmmVY7AqLGryiUTlt45BCcwUldGg2QVGyQpQJST+7lXm2UJGeBt 0QkAi37arcAayseOjPsxxVp612kbr7FHYkhaaFIHJ14G7hZDafYq1ppJGJupKFtI5Y EsjsvJiwKkwfB1mHQSNGGAdIXQqjOgg+As+xxSAVlxL4oELIU23fFHhJAdfQnD/knV HFl0zEb8F+3nqkBxspWX+Bh7HJuww3n7Jb8FEB1Mz5acJNvjCtCDX/PCUoH3GE9teP aP6l6g+74c2ezx3HzQzQLKMoHn7+USiTJmccw+KIseujCWiiK179PBeURjVWkUYInB LZNsw6AJsFrTw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 720FC18004C for ; Mon, 13 Apr 2026 15:21:04 +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.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-b3-smtp.messagingengine.com (fhigh-b3-smtp.messagingengine.com [202.12.124.154]) (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, 13 Apr 2026 15:21:03 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id 297107A01F0 for ; Mon, 13 Apr 2026 11:20:58 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-04.internal (MEProxy); Mon, 13 Apr 2026 11:20:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm2; t=1776093657; x=1776180057; bh=epjMqmd6M/4lhQAREJp6K SzqVR0Cv5BZukmI+FixVnk=; b=fDkK/OpIZ/q4yoLmFvAHb+UVvmJDnCdSjTI1g 9netJ+meLePnNCozwZaWgf9ceog4hYK3MpHhjvfYD2iBUjjTQvNTh85rBQ0Xaq4Z MBJ9Vie0/4kz9CnFHjnZGF0kVpFfRdekXmQ8Yws0YM+2arnr9ao55gCH4YToO+vp Ra52Mi+CWR7craFpz+wHOrPSDgZG0hwMu1F1FjcjTG0RCJHft+ECDN+URmq3PF41 txTuGeh/QUu3hJX14jGU7ALOsWqytw73oKZesNP9sqwvp0wZJwJ4vy9TCL9z21gp KO1Y9stlkVVqy7zY/MkMf5PcTT+EBivkyCLJcogJZTTm1X1pQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1776093657; x=1776180057; bh=e pjMqmd6M/4lhQAREJp6KSzqVR0Cv5BZukmI+FixVnk=; b=RM8t/E6JWT4txEVwu /uzVplTmznReBW2L5OCwLzA2xk3PfWisqDbcnZpn3AhjbUSoqHG/Iaob+Ek96x67 cI5ncGA/dSd+eHAtNH8eBkfaRt15z7t8t/++Cd5IKLPoai6p3UVAP3JCxqwgtnzo /h/l47BryYcGS8YbZP3Um2N+WSqSb10DKB5/UXcEm2WyUvS1fjEdSGM1FlZk7h0a BtCRfUugAQcvzKCV2wZrL1gf8FUkg5cVx+dF/+ss0tttvorwuWKelYQHpr7uMYrR bupY67EvkPrXIKFFx0XxMv4bLTKjDs0CA1tpC/xV1pE6/mlN6uG9GqO9r6/fSqM0 iv5sQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdefkeehkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefoggffhffvkfgjfhfutgfgsehtjeertdertddtnecuhfhrohhmpedfnfgrrhhrhicu ifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomheqne cuggftrfgrthhtvghrnhepudegvdelgfeugeehfeejteffudevleethfefgeejffffleeg tddtveekgeekudfgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmpdhnsggprhgtphht thhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehinhhtvghrnhgrlhhsse hlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 657E7700069; Mon, 13 Apr 2026 11:20:57 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: AwW8RH0VV87o Date: Mon, 13 Apr 2026 10:20:25 -0500 To: "php internals" Message-ID: In-Reply-To: References: Subject: Re: [PHP-DEV] [RFC] [Discussion] array_get and array_has functions Content-Type: text/plain Content-Transfer-Encoding: 7bit From: larry@garfieldtech.com ("Larry Garfield") On Sat, Apr 11, 2026, at 5:30 AM, Barel wrote: > After the discussion here and after speaking to other developers, I > have decided to drop the dot notation entirely from this RFC and only > leave the option to use an array path. Using dot (or similar) notations > can be easily achieved using a simple explode or more complex code if > we need to do more complex setups like escaping. The main goal of the > RFC has always been being able to handle dynamic paths. The > implementation has also been updated and is now much simpler > > Cheers > > Carlos "4) Using dot or similar notations " This should be bullet point 3, not no 4. I agree with Tim that an invalid path segment should error in some way, rather than just using the default. If a non-int/string path segment is encountered, it 100% of the time means the developer screwed up in some way so they should know to fix it. One of the most common uses for structure-unclear arrays I run into is (bad) APIs that have a value that is either a primitive or an array of primitives. Can you include an example showing how these functions would help in that situation? Eg, this JSON: { "state": "IL" } vs {"state": ["IL", "CA", "NY"] } Presumably you also have some real-world cases in mind that you've run into. Can you include versions of those in the examples to get a better sense of what usage would look like in practice? To Tim's naming point, perhaps `array_has_path()` / `array_get_path()`? (Or maybe `path` first, not sure.) --Larry Garfield