class Arrays (View source)

Methods

get(array $array, string|int|array $keys, mixedvar $default = null)

Fetches a value from an (multidimensional) array.

set(array $array, unknown_type $keys, unknown_type $value)

Sets a value in an (multidimensional) array, creating the arrays recursivly.

array
parseKeys(string|array $keys)

Turns the string keys into an array of keys.

array
flatten(array $array)

Takes a multidimensional array and flattens it.

subset($a, $b)

Returns whether $a is a proper subset of $b.

Details

get(array $array, string|int|array $keys, mixedvar $default = null)

Fetches a value from an (multidimensional) array.

Parameters

array $array
string|int|array $keys

Either one key or multiple keys

mixedvar $default

the value that is returned if key is not found

set(array $array, unknown_type $keys, unknown_type $value)

Sets a value in an (multidimensional) array, creating the arrays recursivly.

Parameters

array $array
unknown_type $keys
unknown_type $value

private array parseKeys(string|array $keys)

Turns the string keys into an array of keys.

Parameters

string|array $keys

Return Value

array

array flatten(array $array)

Takes a multidimensional array and flattens it.

Parameters

array $array

Return Value

array

subset($a, $b)

Returns whether $a is a proper subset of $b.

Parameters

$a
$b