A collection of global array_*
functions appending to the native PHP set.
- php: >=5.3.0
Install the latest version with:
composer require 'quorum/array-functions'
function array_flatten(array $array [, $allow_duplicates = false])
- array
$array
- The Array to be Flattened - bool
$allow_duplicates
- Should the array allow duplicates
- array - The resulting array or NULL on failure
Given an array, find all the values recursively.
function array_blend(array $arrays [, array $keys = null])
- array
$arrays
- An array of arrays. - array | null
$keys
- The merged array.
- array - The resulting blended array
Given an array of arrays, merges the array's children together.
function array_key_array(array $arrays, $key)
- array
$arrays
- An array of similarly keyed arrays - int | string
$key
- The desired key
- array - The flattened array
Given an array of similarly keyed arrays, returns an array of only the values of the key.
function array_keys_array(array $arrays, $keys)
- array
$arrays
- An array of similarly keyed arrays - array | int | string
$keys
- The key or array of keys to return
- array - The array of arrays with just the selected keys
Given an array of similarly keyed arrays, returns an array of only the selected keys.
function array_key_refill(array $array, array $keys [, $fill = array()])
- array
$array
- A Keyed array - array
$keys
- The keys that must exist - mixed
$fill
- The desired value to fill with
- array
Given a keyed array, fills any missing values.