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
array
array('from1' => 'to1', 'from2' => 'to2', 'from3' => 'to3', ...)
filterField(array $array, string $fieldName, boolean $unique, boolean $removeNull) : array
It does not preserve the array keys.
array
the input array
string
the field to filter out
boolean
default true it can filter out multiple occurences of the same value
boolean
default false if true then removes null values from the result set
array
filterKeyValuePairs(array $array, string $key, string $value, boolean $unique) : array
Both the $pKey and $pValue parameters are array keys in the $pArray.
array
the input array
string
key filtering
string
value filtering
boolean
default true return with unique values only or not
array
flatten(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.
array
The array to flatten
array
objectToArray(object $object) : array
Empty objects become empty arrays.
object
array
removeEmptyElements(array $array, boolean $keepKeys) : array
array
The array to clean
boolean
default true keep the original keys or assign new (numeric) ones
array
removeFields(array $array, string $pattern) : array
It handles multi-dimensional arrays.
array
the input array
string
pattern for filter
array
shuffleAssoc(array $array) : boolean
array
the array to shuffle, reference-type parameter, it contains the result, too
boolean
toHtmlTable(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
string
default '' the name of the variable or any other string, it will appear as a heading
string
default '' a valid CSS width, like '100px', '10%', '13em', etc.
string
default '#404040'
string
default '#404040'
string