Arrays
class Arrays
Array tools library.
Methods
Static class - cannot be instantiated.
Returns item from array or $default if item is not set.
Returns reference to array item.
Recursively appends elements of remaining keys from the second array to the first.
Searches the array for a given key and returns the offset if successful.
Inserts new array before item specified by key.
Inserts new array after item specified by key.
Renames key in array.
Returns array entries that match the pattern.
Returns flattened array.
Finds whether a variable is a zero-based integer indexed array.
Reformats table to associative tree. Path looks like 'field|field[]field->field=field'.
Normalizes to associative array.
Picks element from the array by key and return its value.
Details
at line 22
final
__construct()
Static class - cannot be instantiated.
at line 36
static mixed
get(array $arr, $key, $default = NULL)
Returns item from array or $default if item is not set.
at line 59
static mixed
getRef($arr, $key)
Returns reference to array item.
at line 76
static array
mergeTree($arr1, $arr2)
Recursively appends elements of remaining keys from the second array to the first.
at line 92
static int|false
searchKey($arr, $key)
Searches the array for a given key and returns the offset if successful.
at line 103
static void
insertBefore(array $arr, $key, array $inserted)
Inserts new array before item specified by key.
at line 114
static void
insertAfter(array $arr, $key, array $inserted)
Inserts new array after item specified by key.
at line 126
static void
renameKey(array $arr, $oldKey, $newKey)
Renames key in array.
at line 141
static array
grep(array $arr, $pattern, $flags = 0)
Returns array entries that match the pattern.
at line 151
static array
flatten(array $arr, $preserveKeys = FALSE)
Returns flattened array.
at line 166
static bool
isList($value)
Finds whether a variable is a zero-based integer indexed array.
at line 176
static array|stdClass
associate(array $arr, $path)
Reformats table to associative tree. Path looks like 'field|field[]field->field=field'.
at line 228
static array
normalize(array $arr, $filling = NULL)
Normalizes to associative array.
at line 246
static mixed
pick(array $arr, $key, $default = NULL)
Picks element from the array by key and return its value.