[RFC] [VOTE] array_get and array_has functions

php.internals

Barel

105 days ago
Hi, I started the vote on this RFC: https://wiki.php.net/rfc/array_get_and_array_has Voting ends 2026-06-01 20:00 UTC Cheers Carlos

Tim Düsterhus

105 days ago
Hi On 5/18/26 22:00, Barel wrote:
> I started the vote on this RFC: > https://wiki.php.net/rfc/array_get_and_array_has
The voting announcement should include a link to the discussion thread, which you forgot. I'm adding it here for convenience: Discussion thread: https://news-web.php.net/php.internals/130559 --------- Please also add the voting thread to the references section. The correct link is: https://news-web.php.net/php.internals/130947 --------- As for the RFC itself - I voted against the RFC for the reasons that I mentioned in this email (non-array should error, not default): https://news-web.php.net/php.internals/130667 Best regards Tim Düsterhus

Bob Weinand

98 days ago
Hey Tim and Barel, On 18.5.2026 22:11:38, Tim Düsterhus wrote:
> Hi > > On 5/18/26 22:00, Barel wrote: >> I started the vote on this RFC: >> https://wiki.php.net/rfc/array_get_and_array_has > > As for the RFC itself - I voted against the RFC for the reasons that I > mentioned in this email (non-array should error, not default): > https://news-web.php.net/php.internals/130667
I actually think non-array should cause default behaviour, the same as missing. The part which I don't quite agree with is having null as default - I'd rather have an error when the path does not exist, by default, and to default to a default value you need to explicitly specify it. I also would suggest to replace a pure exists by a number how many parts of the path are missing. E.g. array_path_missing($array, $path). $path = ["foo", 0, "bar"]; if (array_path_missing($array, $path) == 0) // found. if ($missing = array_path_missing($array, $path)) { die("Error: Key " . implode(".", array_slice($path, 0, -$missing)) . " missing"); } Which lends itself pretty nicely to trivial nested array verification. Overall I really liked this RFC, just the default behaviour of missing/non-array path entry is a bit disappointing. I hope it'll be resubmitted with slight improvements there! Thanks, Bob

Barel

91 days ago
Hi The voting period for this RFC has finished. There was 1 "yes" vote, 17 "no" votes and 6 "Abstain" votes. The RFC has been declined Thanks to everyone who participated in the discussion and the voting RFC: https://wiki.php.net/rfc/array_get_and_array_has Discussion: https://news-web.php.net/php.internals/130559 Voting thread: https://news-web.php.net/php.internals/130947 Cheers Carlos On Mon, 18 May 2026 at 22:00, Barel <barel.barelon@gmail.com> wrote: