class ArrayUtils

Class ArrayUtils

Methods

static array
flatArray(array $array)

Flatten an array to leave it at a single level.

static array
addToArray(array $initialArray, array $nextArray)

Add the elements of the 2nd array behind those of the first.

static bool
isTrue(array $param, string $key)

Return true if $param is setted and is 'yes', otherwise return false.

static string
getItem(array $itemsArray, string $itemIndex, string|null $defaultValue = null)

Given an array of parameters, an index and a possible default value, returns a literal of the form: index = 'value'.

static array
arrayMergeRecursiveEx(array $array1, array $array2)

Array recursive merge excluding duplicate values.

Details

at line 25
static array flatArray(array $array)

Flatten an array to leave it at a single level.

Ignore the value of the indexes of the array, taking only the values. Remove spaces from the result and convert it to lowercase.

Parameters

array $array

Return Value

array

at line 47
static array addToArray(array $initialArray, array $nextArray)

Add the elements of the 2nd array behind those of the first.

Parameters

array $initialArray
array $nextArray

Return Value

array

at line 64
static bool isTrue(array $param, string $key)

Return true if $param is setted and is 'yes', otherwise return false.

Parameters

array $param
string $key

Return Value

bool

at line 80
static string getItem(array $itemsArray, string $itemIndex, string|null $defaultValue = null)

Given an array of parameters, an index and a possible default value, returns a literal of the form: index = 'value'.

It is used, for example, to assign attributes to an html statement.

Parameters

array $itemsArray
string $itemIndex
string|null $defaultValue

Return Value

string

at line 96
static array arrayMergeRecursiveEx(array $array1, array $array2)

Array recursive merge excluding duplicate values.

Parameters

array $array1
array $array2

Return Value

array