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.
Details
at line 24
final
__construct()
Static class - cannot be instantiated.
at line 38
static mixed
get(array $arr, $key, $default = NULL)
Returns item from array or $default if item is not set.
at line 61
static mixed
getRef($arr, $key)
Returns reference to array item.
at line 78
static array
mergeTree($arr1, $arr2)
Recursively appends elements of remaining keys from the second array to the first.
at line 94
static int|false
searchKey($arr, $key)
Searches the array for a given key and returns the offset if successful.
at line 105
static void
insertBefore(array $arr, $key, array $inserted)
Inserts new array before item specified by key.
at line 116
static void
insertAfter(array $arr, $key, array $inserted)
Inserts new array after item specified by key.
at line 128
static void
renameKey(array $arr, $oldKey, $newKey)
Renames key in array.
at line 143
static array
grep(array $arr, $pattern, $flags = 0)
Returns array entries that match the pattern.
at line 153
static array
flatten(array $arr, $preserveKeys = FALSE)
Returns flattened array.
at line 168
static bool
isList($value)
Finds whether a variable is a zero-based integer indexed array.
at line 178
static array|stdClass
associate(array $arr, $path)
Reformats table to associative tree. Path looks like 'field|field[]field->field=field'.