array_keys
Function • Params and return types changed in PHP 8.0
Return all the keys or a subset of the keys of an array.
array_keys Function synopsis
array_keys(
array $array,
mixed $filter_value = <default>,
bool $strict = false
): array
Parameters
$array
Typearray
An array containing keys to return.
$filter_value
OptionalTypemixedDefault value
If specified, then only keys containing this value are returned.
$strict
OptionalTypeboolDefault valuefalse
Determines if strict comparison (===) should be used during the search.
Return value
Typearray
Returns an array of all the keys in $array.
Changes to the array_keys Function
PHP 8.0
- Return type added:
array - Parameter name of parameter #1 changed:
$argto$array - Parameter type added for parameter #1 (
$array):array - Parameter name of parameter #2 changed:
$search_valueto$filter_value - Parameter type added for parameter #2 (
$filter_value):mixed - Parameter default value added for position #2 (
$filter_value):<default> - Parameter type added for parameter #3 (
$strict):bool - Parameter default value added for position #3 (
$strict):false
array_keys(
- $arg,
+ array $array,
- $search_value,
+ mixed $filter_value = <default>,
- $strict
+ bool $strict = false
- )
+ ): array array_keys Function Availability
array_keys Function Availability| PHP Version | Availability |
|---|---|
| PHP 8.6Upcoming Release | Yes |
| PHP 8.5Supported (Latest) | Yes |
| PHP 8.4Supported | Yes |
| PHP 8.3Security-Fixes Only | Yes |
| PHP 8.2Security-Fixes Only | Yes |
| PHP 8.1Unsupported | Yes |
| PHP 8.0Unsupported | Yes |
| PHP 7.4Unsupported | Yes |
| PHP 7.3Unsupported | Yes |
| PHP 7.2Unsupported | Yes |
| PHP 7.1Unsupported | Yes |
| PHP 7.0Unsupported | Yes |
| PHP 5.6Unsupported | Yes |
| PHP 5.5Unsupported | Yes |
| PHP 5.4Unsupported | Yes |
| PHP 5.3Unsupported | Yes |