Void Parameter In array_keys()

<?php

$array = [3 => null, 4 => 4];

var_dump(array_keys($array, null));
// 3

var_dump(array_keys($array /*, void */));
// 3, 4

There is a ‘void’ parameter in PHP. It is the second argument of array_keys().

That second parameter is often omitted (and unknown).

If present, it is typed ‘mixed’ to allow any value to be searched (here, null).

If absent, array_keys() returns ALL keys. When absent, it is not null, nor any other type. The last one possible is ‘void’.

Type is then : void|mixed.

See Also

PHP Features

Last updated: 14 July 2026