[PHP-DEV] [RFC] [VOTE] array_get and array_has functions

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

Hi

On 5/18/26 22:00, Barel wrote:

I started the vote on this RFC:
PHP: 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: php.internals: [RFC] [Discussion] array_get and array_has functions

---------

Please also add the voting thread to the references section. The correct link is: php.internals: [RFC] [VOTE] array_get and array_has functions

---------

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): php.internals: Re: [RFC] [Discussion] array_get and array_has functions

Best regards
Tim Düsterhus

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:
PHP: 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): php.internals: Re: [RFC] [Discussion] array_get and array_has functions

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

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:

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