Array helper class.

package Core
subpackage Array

 Methods

Very cool algorithm for sorting multi-dimensional arrays.

csort() : array
Static

Found at http://us2.php.net/manual/en/function.array-multisort.php Syntax:

$new_array = cArray::csort($array [, 'col1' [, SORT_FLAG [, SORT_FLAG]]]...);

Explanation: $array is the array you want to sort, 'col1' is the name of the column you want to sort, SORT_FLAGS are : SORT_ASC, SORT_DESC, SORT_REGULAR, SORT_NUMERIC, SORT_STRING you can repeat the 'col',FLAG,FLAG, as often you want, the highest prioritiy is given to the first - so the array is sorted by the last given column first, then the one before ... Example:

$array = cArray::csort($array,'town','age', SORT_DESC, 'name');

Returns

array

initializeKey()

initializeKey($aArray, $sKey, $mDefault) 
Static

Parameters

$aArray

$sKey

$mDefault

searchRecursive()

searchRecursive(array $arr, mixed $search, bool $partial, bool $strict) : mixed | bool
Static
TODO : Ask timo to document this. Note: If subarrays exists, this function currently returns the key of the array given by $arr, and not from the subarrays (todo: add flag to allow this)

Parameters

$arr

array

The array to search

$search

mixed

The value to search in the array

$partial

bool

$strict

bool

Returns

mixedboolThe key/index of the array containing the searched value or false.

Sorts an array by changing the locale temporary to passed value.

sortWithLocale(array $arr, string $locale) : array
Static

Parameters

$arr

array

The array to sort

$locale

string

The locale to change before sorting

Returns

arraySorted array

Strip whitespace (or other characters) from the beginning and end of each item in array.

trim(array $arr, string $charlist) : array
Static

Similar to trim() function.

Parameters

$arr

array

$charlist

string

Returns

arrayThe trimmer array