class Arr

Array helper.

Methods

static 
set(array $array, string $path, mixed $value)

Sets an array value using "dot notation".

static bool
has(array $array, string $path)

Search for an array value using "dot notation". Returns TRUE if the array key exists and FALSE if not.

static mixed
get(array $array, string $path, mixed $default = null)

Returns value from array using "dot notation".

static bool
delete(array $array, string $path)

Deletes an array value using "dot notation".

static mixed
random(array $array)

Returns a random value from an array.

static bool
isAssoc(array $array)

Returns TRUE if the array is associative and FALSE if not.

static array
pluck(array $array, string $key)

Returns the values from a single column of the input array, identified by the key.

static array
expandKey(array $array, string $key)

Expands a wildcard key to an array of "dot notation" keys.

Details

at line 39
static set(array $array, string $path, mixed $value)

Sets an array value using "dot notation".

Parameters

array $array &$array Array you want to modify
string $path Array path
mixed $value Value to set

at line 65
static bool has(array $array, string $path)

Search for an array value using "dot notation". Returns TRUE if the array key exists and FALSE if not.

Parameters

array $array Array we're goint to search
string $path Array path

Return Value

bool

at line 90
static mixed get(array $array, string $path, mixed $default = null)

Returns value from array using "dot notation".

Parameters

array $array Array we're going to search
string $path Array path
mixed $default Default return value

Return Value

mixed

at line 114
static bool delete(array $array, string $path)

Deletes an array value using "dot notation".

Parameters

array $array &$array Array you want to modify
string $path Array path

Return Value

bool

at line 141
static mixed random(array $array)

Returns a random value from an array.

Parameters

array $array Array you want to pick a random value from

Return Value

mixed

at line 152
static bool isAssoc(array $array)

Returns TRUE if the array is associative and FALSE if not.

Parameters

array $array Array to check

Return Value

bool

at line 164
static array pluck(array $array, string $key)

Returns the values from a single column of the input array, identified by the key.

Parameters

array $array Array to pluck from
string $key Array key

Return Value

array

at line 183
static array expandKey(array $array, string $key)

Expands a wildcard key to an array of "dot notation" keys.

Parameters

array $array Array
string $key Wildcard key

Return Value

array