FINAL
Various PHP array related utility functions.
Methods
findByKeyOrNull
STATIC
findByKeyOrNull(array $array, mixed $key) : mixed
Find an item in an associative array by a key value, or return null if not found.
Parameters
Name | Description |
---|---|
|
|
|
|
Returns
mixed
The value of the item in the array with the given key, or null if not found.
findByKeyOrDefault
STATIC
findByKeyOrDefault(array $array, mixed $key, mixed $default) : mixed
Find an item in an associative array by a key value, or return default if not found.
Parameters
Name | Description |
---|---|
|
|
|
|
|
|
Returns
mixed
The value of the item in the array with the given key, or the given default if not found.
arrayMergeIgnoreCase
STATIC
arrayMergeIgnoreCase()
Merge a number of arrays using a case insensitive comparison for the array keys.
Throws
\google\appengine\util\InvalidArgumentException
If less than two arrays are passed to the function, or one of the arguments is not an array.
isAssociative
STATIC
isAssociative( $arr) : boolean
Checks whether an array's keys are associative. An array's keys are associate if they are not values 0 to count(array) - 1.
Parameters
Name | Description |
---|---|
|
array The array whos keys will be checked. |
Returns
boolean
True if the array's keys are associative. Also true in the case of an empty array.
all
STATIC
all( $array, $predicate) : boolean
Checks whether every value in an array passes the provided predicate.
Parameters
Name | Description |
---|---|
|
array The array to test. |
|
callable A predicate which should take one argument and return a boolean. |
Returns
boolean
Whether every value in the array passes the predicate.
allInstanceOf
STATIC
allInstanceOf( $array, $class) : boolean
Checks whether every value in an array is an instance of a class.
Parameters
Name | Description |
---|---|
|
array The array to test. |
|
The fully qualified class name to check every array value with. |
Throws
\InvalidArgumentException
if no class with name $class is found.
Returns
boolean
Whether every value in the array is an instance of $class.