Class ArrayTools (namespace Nette)
Array tools library.
Public Method Summary | |
---|---|
ArrayTools |
__construct
()
Static class - cannot be instantiated.
|
static mixed |
get
($arr, mixed $key, [mixed $default =
NULL ])
Returns array item or $default if item is not set.
|
static & mixed |
getRef
(mixed &$arr, mixed $key)
Returns reference to array item or $default if item is not set.
|
static void |
insertAfter
(&$arr, mixed $key, $inserted)
Inserts new array after item specified by key.
|
static void |
insertBefore
(&$arr, mixed $key, $inserted)
Inserts new array before item specified by key.
|
static array |
mergeTree
(array $arr1, array $arr2)
Recursively appends elements of remaining keys from the second array to the first.
|
static void |
renameKey
(&$arr, mixed $oldKey, mixed $newKey)
Renames key in array.
|
static int |
searchKey
(array $arr, mixed $key)
Searches the array for a given key and returns the offset if successful.
|
Method Details | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
line 27 __constructpublic ArrayTools __construct () Static class - cannot be instantiated.
|
||||||||||||||||||
line 42 getpublic static mixed get ($arr, mixed $key, [mixed $default = Returns array item or $default if item is not set. Example: $val = ArrayTools::get($arr, 'i', 123);
|
||||||||||||||||||
line 62 getRefpublic static mixed & getRef (mixed &$arr, mixed $key) Returns reference to array item or $default if item is not set.
|
||||||||||||||||||
line 131 insertAfterpublic static void insertAfter (&$arr, mixed $key, $inserted) Inserts new array after item specified by key.
|
||||||||||||||||||
line 116 insertBeforepublic static void insertBefore (&$arr, mixed $key, $inserted) Inserts new array before item specified by key.
|
||||||||||||||||||
line 82 mergeTreepublic static array mergeTree (array $arr1, array $arr2) Recursively appends elements of remaining keys from the second array to the first.
|
||||||||||||||||||
line 147 renameKeypublic static void renameKey (&$arr, mixed $oldKey, mixed $newKey) Renames key in array.
|
||||||||||||||||||
line 101 searchKeypublic static int searchKey (array $arr, mixed $key) Searches the array for a given key and returns the offset if successful.
|