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 int |
searchKey
(array $arr, mixed $key)
Searches the array for a given key and returns the offset if successful.
|
Method Details | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
line 35 __constructpublic ArrayTools __construct () Static class - cannot be instantiated.
|
||||||||||||||||||
line 50 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 70 getRefpublic static mixed & getRef (mixed &$arr, mixed $key) Returns reference to array item or $default if item is not set.
|
||||||||||||||||||
line 139 insertAfterpublic static void insertAfter (&$arr, mixed $key, $inserted) Inserts new array after item specified by key.
|
||||||||||||||||||
line 124 insertBeforepublic static void insertBefore (&$arr, mixed $key, $inserted) Inserts new array before item specified by key.
|
||||||||||||||||||
line 90 mergeTreepublic static array mergeTree (array $arr1, array $arr2) Recursively appends elements of remaining keys from the second array to the first.
|
||||||||||||||||||
line 109 searchKeypublic static int searchKey (array $arr, mixed $key) Searches the array for a given key and returns the offset if successful.
|