pick.php
Table of Contents
Functions
- pick() : array<string|int, mixed>
- Keeps only the specified keys from an array (inverse of removeKeys).
Functions
pick()
Keeps only the specified keys from an array (inverse of removeKeys).
pick(array<string|int, mixed> $array, array<string|int, mixed> $keys) : array<string|int, mixed>
This function returns a new array containing only the entries whose keys are present in the given keys list.
Parameters
- $array : array<string|int, mixed>
-
The target array to filter.
- $keys : array<string|int, mixed>
-
The list of keys to keep.
Tags
Return values
array<string|int, mixed> —The filtered array containing only the specified keys.