Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
83 lines (73 sloc) 1.54 KB

Arr

The Arr provides dot notation for PHP arrays.

Installation

composer require webiik/arr

Example

$array = [];
$arr = new \Webiik\Arr\Arr();
$arr->set('dot.notation.key', ['key' => 'val'], $array);

Adding

set

set(string $key, $val, array &$array): void

set() sets value $val to $array under (dot notation) $key.

$arr->set('dot.notation.key', ['key' => 'val'], $array);

add

add(string $key, $val, array &$array): void

add() ads value $val to $array under (dot notation) $key.

$arr->add('dot.notation.key', 'val', $array);

Check

isIn

isIn(string $key, array $array): bool

isIn() determines if $key is set in array and if its value is not NULL.

$arr->isIn('dot.notation.key', $array)

Getting

get

get(string $key, array $array)

get() gets value from $array by (dot notation) $key.

$arr->get('dot.notation.key', $array)

Deletion

delete

delete(string $key, array &$array): void

delete() removes value from $array by (dot notation) $key.

$arr->delete('dot.notation.test', $array);

Resources

You can’t perform that action at this time.