Page MenuHomePhorge

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$dictDictionary of key-value pairs to select from.
list$keysList of keys to select.
Return
dictDictionary 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.