RE: [PHP-DEV] [RFC] [Discussion] array_get and array_has functions
| From: | Juris Evertovskis | Date: | Sat, 04 Apr 2026 16:04:08 +0000 |
| Subject: | RE: [PHP-DEV] [RFC] [Discussion] array_get and array_has functions | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-130560@lists.php.net to get a copy of this message | ||
From: Barel <barel.barelon@gmail.com>
Sent: Saturday, April 4, 2026 5:06 PM
To: PHP internals <internals@lists.php.net>
Subject: [PHP-DEV] [RFC] [Discussion] array_get and array_has functions
Hi,
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.
This is the link to the RFC: https://wiki.php.net/rfc/array_get_and_array_has
This is the link to the proposed implementation: https://github.com/php/php-src/pull/21637
Thanks!!
Carlos
Hey,
Very useful functions!
Why did you decide to not handle keys with dots? It would prevent these functions from being used in
tools that might sometimes receive something like
example.comas the key. The similar
userland functions that I’ve seen do at least support the exact dotted key as well, even if not
offering a full dotted<->nested equivalence with priority rules, partial nested-dotted and
other fun stuff.
I’ve also found it quite useful to have [‘user.name’ => ‘Alice’] be
equivalent to [‘user’ => [‘name’ => ‘Alice’]] for testing/mocking
more complex structures.
BR,
Juris