Arrays implements ArraysContract
Interfaces, Classes and Traits
Table of Contents
- add() : array<string|int, mixed>
- Add an element to an array using "dot" notation if it doesn't exist.
- append() : array<string|int, mixed>
- Push an item onto the end of an array.
- arrayChangeCaseKey() : array<string|int, mixed>
- Changes the case of all keys in an array.
- arrayChangeCaseValue() : array<string|int, mixed>
- Changes the case of all values in an array.
- dot() : array<string|int, mixed>
- Converted a multi-dimensional associative array with `dot`.
- except() : array<string|int, mixed>
- Get all of the given array except for a specified array of keys.
- forget() : mixed
- Remove one or many array items from a given array using "operator" notation.
- get() : array<string|int, mixed>
- Get an item from an array using "operator" notation.
- getType() : mixed
- Get type of array.
- has() : bool
- Determine if an item or items exist in an array using 'Operator' notation.
- isAssoc() : bool
- Determine array is Assoc.
- isMulti() : bool
- Determine array is multi-dimensional.
- isReallyArray() : bool
- Determine is given value is really, array?.
- isSequential() : bool
- Determine array is (sqquential).
- leastOccurring() : array<string|int, mixed>
- Get the least occurring value from array.
- mostOccurring() : array<string|int, mixed>
- Get the most occurring value from array.
- multiToAssoc() : array<string|int, mixed>
- Convert a multi-dimensional array to assoc.
- multiToAssocWithSpecificOpr() : array<string|int, mixed>
- Converted a multi-dimensional associative array with `operator`.
- pluck() : mixed
- Get multiple values of same keys from multi-dimessional array.
- prepend() : array<string|int, mixed>
- Push an item onto the beginning of an array.
- pull() : mixed
- Get a value from the array, and remove it.
- query() : string
- Convert the array into a query string.
- random() : mixed
- Get one or a specified number of random values from an array.
- removeDuplicates() : mixed
- Remove duplicate values from array.
- set() : array<string|int, mixed>
- Set an array item to a given value using "operator" notation.
- shuffle() : bool
- Shuffle the given array for associative arrays, preserves key=>value pairs.
- subSetOfArray() : array<string|int, mixed>
- Get a subset of the items from the given array.
- unique() : array<string|int, mixed>
- Get the unique elements from array.
- where() : array<string|int, mixed>
- Filter the array using the given callback.
- mostOrLeastOccurring() : array<string|int, mixed>
- Get the most|least occurring value from array.
Methods
add()
Add an element to an array using "dot" notation if it doesn't exist.
public
static add(array<string|int, mixed> $array, string $key, mixed $value[, string $opr = null ]) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
-
Array to be evaluated
- $key : string
-
Key
- $value : mixed
- $opr : string = null
-
Notation like 'dot'
Tags
Return values
array<string|int, mixed> —append()
Push an item onto the end of an array.
public
static append(array<string|int, mixed> $array, mixed $value[, mixed $key = null ]) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
-
Dafult array, where value to append.
- $value : mixed
-
Value to be append.
- $key : mixed = null
-
Key.
Tags
Return values
array<string|int, mixed> —arrayChangeCaseKey()
Changes the case of all keys in an array.
public
static arrayChangeCaseKey(array<string|int, mixed> $array[, int $case = CASE_LOWER ]) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
-
The array to work on.
- $case : int = CASE_LOWER
-
Either CASE_UPPER or CASE_LOWER (default).
Tags
Return values
array<string|int, mixed> —arrayChangeCaseValue()
Changes the case of all values in an array.
public
static arrayChangeCaseValue(array<string|int, mixed> $array[, string $case = CASE_LOWER ]) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
-
The array to work on.
- $case : string = CASE_LOWER
-
Either CASE_UPPER or CASE_LOWER (default).
Tags
Return values
array<string|int, mixed> —dot()
Converted a multi-dimensional associative array with `dot`.
public
static dot(array<string|int, mixed> $arrays[, bool $assocOutput = false ]) : array<string|int, mixed>
Parameters
- $arrays : array<string|int, mixed>
-
Arrays.
- $assocOutput : bool = false
-
Switch to output assoc arrays.
Tags
Return values
array<string|int, mixed> —except()
Get all of the given array except for a specified array of keys.
public
static except(array<string|int, mixed> $array, array<string|int, mixed>|string $keys) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
-
Default array.
- $keys : array<string|int, mixed>|string
-
Keys
Tags
Return values
array<string|int, mixed> —forget()
Remove one or many array items from a given array using "operator" notation.
public
static forget(array<string|int, mixed> &$array, array<string|int, mixed>|string $keys[, mixed $opr = null ]) : mixed
Parameters
- $array : array<string|int, mixed>
-
Array to be evaluated.
- $keys : array<string|int, mixed>|string
-
Keys.
Note: Adapted from laravel\framework.
- $opr : mixed = null
Tags
Return values
mixed —get()
Get an item from an array using "operator" notation.
public
static get(array<string|int, mixed> $array[, mixed $key = null ][, mixed $default = null ][, string $opr = null ]) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
-
Default array.
- $key : mixed = null
- $default : mixed = null
- $opr : string = null
-
Operator notaiton.
Tags
Return values
array<string|int, mixed> —getType()
Get type of array.
public
static getType(array<string|int, mixed> $array) : mixed
Parameters
- $array : array<string|int, mixed>
-
The array to work on.
Tags
Return values
mixed —has()
Determine if an item or items exist in an array using 'Operator' notation.
public
static has(array<string|int, mixed> $array[, array<string|int, mixed>|string $keys = null ][, string $opr = null ]) : bool
Parameters
- $array : array<string|int, mixed>
-
Default array.
- $keys : array<string|int, mixed>|string = null
-
Keys to search.
- $opr : string = null
-
Operator notaiton.
Tags
Return values
bool —isAssoc()
Determine array is Assoc.
public
static isAssoc(array<string|int, mixed> $array) : bool
Parameters
- $array : array<string|int, mixed>
Tags
Return values
bool —isMulti()
Determine array is multi-dimensional.
public
static isMulti(array<string|int, mixed> $array) : bool
Parameters
- $array : array<string|int, mixed>
Tags
Return values
bool —isReallyArray()
Determine is given value is really, array?.
public
static isReallyArray(mixed $value) : bool
Parameters
- $value : mixed
-
Value to be checked.
Tags
Return values
bool —isSequential()
Determine array is (sqquential).
public
static isSequential(array<string|int, mixed> $array) : bool
Parameters
- $array : array<string|int, mixed>
-
Value to be check.
Tags
Return values
bool —leastOccurring()
Get the least occurring value from array.
public
static leastOccurring(array<string|int, mixed> $array[, string|int $key = '' ]) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
-
The array to work on.
- $key : string|int = ''
-
Key that need to evaulate.
Tags
Return values
array<string|int, mixed> —mostOccurring()
Get the most occurring value from array.
public
static mostOccurring(array<string|int, mixed> $array[, string|int $key = '' ]) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
-
The array to work on.
- $key : string|int = ''
-
Key that need to evaulate.
Tags
Return values
array<string|int, mixed> —multiToAssoc()
Convert a multi-dimensional array to assoc.
public
static multiToAssoc(array<string|int, mixed> $arrays) : array<string|int, mixed>
Parameters
- $arrays : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —multiToAssocWithSpecificOpr()
Converted a multi-dimensional associative array with `operator`.
public
static multiToAssocWithSpecificOpr(array<string|int, mixed> $arrays[, string $opr = null ][, bool $assocOutput = false ][, string $_key = null ]) : array<string|int, mixed>
Parameters
- $arrays : array<string|int, mixed>
-
Arrays.
- $opr : string = null
-
Operator.
- $assocOutput : bool = false
-
Switch to output assoc arrays.
- $_key : string = null
-
the previous key of the object
Tags
Return values
array<string|int, mixed> —pluck()
Get multiple values of same keys from multi-dimessional array.
public
static pluck(array<string|int, mixed> $array, mixed $key) : mixed
Parameters
- $array : array<string|int, mixed>
-
The array to work on.
- $key : mixed
-
The specific key to search/get values.
Tags
Return values
mixed —prepend()
Push an item onto the beginning of an array.
public
static prepend(array<string|int, mixed> $array, mixed $value[, mixed $key = null ]) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
-
Dafult array.
- $value : mixed
-
Value to be append.
- $key : mixed = null
-
Key.
Tags
Return values
array<string|int, mixed> —pull()
Get a value from the array, and remove it.
public
static pull(array<string|int, mixed> &$array, string $key[, mixed $default = null ][, mixed $opr = null ]) : mixed
Parameters
- $array : array<string|int, mixed>
-
Default Array.
- $key : string
-
Keys
- $default : mixed = null
-
Default value
- $opr : mixed = null
Tags
Return values
mixed —query()
Convert the array into a query string.
public
static query(array<string|int, mixed> $array) : string
Parameters
- $array : array<string|int, mixed>
-
The array to work on.
Tags
Return values
string —random()
Get one or a specified number of random values from an array.
public
static random(array<string|int, mixed> $array[, int|null $i = null ]) : mixed
Parameters
- $array : array<string|int, mixed>
-
The array to work on.
- $i : int|null = null
-
Specifies how many entries should be picked.
Tags
Return values
mixed —removeDuplicates()
Remove duplicate values from array.
public
static removeDuplicates(array<string|int, mixed> $array[, string|int $key = '' ]) : mixed
Parameters
- $array : array<string|int, mixed>
-
The array to work on.
- $key : string|int = ''
-
Key that need to evaulate.
Tags
Return values
mixed —set()
Set an array item to a given value using "operator" notation.
public
static set(array<string|int, mixed> &$array[, string $key = null ][, mixed $value = null ][, string $opr = null ]) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
-
Array to be evaluated.
- $key : string = null
-
Key
- $value : mixed = null
-
Value
- $opr : string = null
-
Notation like 'dot'
Tags
Return values
array<string|int, mixed> —shuffle()
Shuffle the given array for associative arrays, preserves key=>value pairs.
public
static shuffle(array<string|int, mixed> &$array) : bool
THIS METION WILL NOT WORKS WITH MULTIDIMESSIONAL ARRAY.
Parameters
- $array : array<string|int, mixed>
-
The array to work on.
Tags
Return values
bool —subSetOfArray()
Get a subset of the items from the given array.
public
static subSetOfArray(array<string|int, mixed> $array, mixed $keys) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
-
Array to be evaulated.
- $keys : mixed
-
Keys
Tags
Return values
array<string|int, mixed> —unique()
Get the unique elements from array.
public
static unique(array<string|int, mixed> $array) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
-
Array ot evaulated
Tags
Return values
array<string|int, mixed> —where()
Filter the array using the given callback.
public
static where(array<string|int, mixed> $array, callable $callback) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
-
The array to work on.
- $callback : callable
-
Callback function.
Tags
Return values
array<string|int, mixed> —mostOrLeastOccurring()
Get the most|least occurring value from array.
private
static mostOrLeastOccurring(string $type, array<string|int, mixed> $array[, string|int $key = '' ]) : array<string|int, mixed>
Parameters
- $type : string
-
The type most|least
- $array : array<string|int, mixed>
-
The array to work on.
- $key : string|int = ''
-
Key that need to evaulate.