| category | OSS |
|---|---|
| package | OSS_Array |
| copyright | Copyright (c) 2007 - 2012, Open Source Solutions Limited, Dublin, Ireland |
| license | New BSD License |
cavCallback(mixed $item, mixed $key, array $params) : void
mixed/p>
mixed¶m array $params
changeValues(array $array, array $fromToArray) : void
Handles nested arrays.
array&$array
arrayarray('from1' => 'to1', 'from2' => 'to2', 'from3' => 'to3', ...)
filterField(array $array, string $fieldName, boolean $unique, boolean $removeNull) : array
It does not preserve the array keys.
arraythe input array
stringthe field to filter out
booleandefault true it can filter out multiple occurences of the same value
booleandefault false if true then removes null values from the result set
arrayfilterKeyValuePairs(array $array, string $key, string $value, boolean $unique) : array
Both the $pKey and $pValue parameters are array keys in the $pArray.
arraythe input array
stringkey filtering
stringvalue filtering
booleandefault true return with unique values only or not
arrayflatten(array $array) : array
Try to avoid recursive arrays to not to go into an infinite loop.
Returns with the values in an associative array by keeping the original key => value pairs. As it keeps the original keys, if a key exists more than once in the structure, it will be overwritten and will appear in the result only once, having the value of the last key-value pair.
arrayThe array to flatten
arrayobjectToArray(object $object) : array
Empty objects become empty arrays.
object
arrayremoveEmptyElements(array $array, boolean $keepKeys) : array
arrayThe array to clean
booleandefault true keep the original keys or assign new (numeric) ones
arrayremoveFields(array $array, string $pattern) : array
It handles multi-dimensional arrays.
arraythe input array
stringpattern for filter
arrayshuffleAssoc(array $array) : boolean
arraythe array to shuffle, reference-type parameter, it contains the result, too
booleantoHtmlTable(array $pArray, string $pTitle, string $pWidth, string $pHeaderBgColour, string $pBorderColour) : string
It handles multi-dimensional arrays, those are represented as nested tables. If $pArray is not an array or an empty array, then it returns with an empty string.
array
stringdefault '' the name of the variable or any other string, it will appear as a heading
stringdefault '' a valid CSS width, like '100px', '10%', '13em', etc.
stringdefault '#404040'
stringdefault '#404040'
string