function array_select_keys($dict, $keys)libphutil Technical Documentation (Core Utilities)
function array_select_keys($dict, $keys)
libphutil Technical Documentation (Core Utilities)
Selects a list of keys from an array, returning a new array with only the key-value pairs identified by the selected keys, in the specified order.
Note that since this function orders keys in the result according to the order they appear in the list of keys, there are effectively two common uses: either reducing a large dictionary to a smaller one, or changing the key order on an existing dictionary.
Parameters
dict | $dict | Dictionary of key-value pairs to select from. |
list | $keys | List of keys to select. |
Return
dict | Dictionary of only those key-value pairs where the key was present in the list of keys to select. Ordering is determined by the list order. |
- Defined
- src/utils/utils.php:607