ArrayUtils

Utilities to perform common array operations

package

Default

Methods

Get all the duplicate values on the provided array Duplicate values with different data types won't be considered as equal ('1', 1 will return false)

getDuplicateElements(array $array) : array
static

Arguments

$array

array

An array containing some elements to test

Response

array

list with all the elements that are duplicated on the provided array

Check if the given array contains duplicate values or not.

hasDuplicateElements(array $array) : boolean
static

Duplicate values with different data types won't be considered as equal ('1', 1 will return false)

Arguments

$array

array

An array containing some elements to test

Response

boolean

True if there are duplicate values, false otherwise

Tells if the given value is an array or not

isArray(mixed $value) : boolean
static

Arguments

$value

mixed

A value to check

Response

boolean

true if the given value is an array, false otherwise

Check if two provided arrays are identical (have exactly the same elements and in the same order).

isEqualTo(array $array1, array $array2) : boolean
static

Arguments

$array1

array

First array to compare

$array2

array

Second array to compare

Response

boolean

true if arrays are exactly the same, false if not

remove all the duplicate values on the provided array Duplicate values with different data types won't be considered as equal ('1', 1 will not be removed)

removeDuplicateElements(array $array) : array
static

Arguments

$array

array

An array with possible duplicate values

Response

array

The same provided array but without duplicate elements

Remove the specified item from an array

removeElement(array $array, mixed $element) 
static
returns

array The provided array but without the specified element (if found). Note that originally received array is not modified by this method

Arguments

$array

array

An array (it will not be modified by this method)

$element

mixed

The element that must be removed from the given array