Module "array"
==============

Array Module

This module extends the built-in functionality of SPL for working with
arrays. Please also have a look at the Language Reference Manual for a
description of the built-in operators provided natively by SPL.
 
builtin array_reindex(array);
-----------------------------

This function re-indexes an array. That means, the order of the elements is
kept as they are, but the keys are newly assigned (using integer, starting
with 0).
 

builtin array_switch(array, key1, key2);
----------------------------------------

This function switches two elements of an array. The keys and values are
not modified by this - only the order of the elements in the array.
 

function array_sort_by_keys(array, order_function);
---------------------------------------------------

Sorting by keys

This function sorts the passed array ussing the passed order function. The
order function is called whenever this function wants to compare two
elements. The key of the 1st element is passed as 1st parameter to the
order_function. The key of the 2nd element as 2nd parameter. The order
function must return 1 if the elements are in the wrong order.

Example:

	var a = [ 5 => 'a', '3' => 'b', '8' => 'c' ];

	array_sort_by_keys(a, function(a,b) { return a > b; });

	foreach i (a)
		debug "$i --> ${a[i]}";

This creates the output:

	SPL Debug: 3 --> b
	SPL Debug: 5 --> a
	SPL Debug: 8 --> c

Small arrays (less then 10 elements) are sorted using a simple bubble sort.
Big arrays are sorted using the system qsort() function (if available) and
using a btree sort otherwise.
 

function array_sort_by_values(array, order_function);
-----------------------------------------------------

Sorting by values

This function is pretty simmilar to array_sort_by_keys. The only
difference is that it passes references to the elements which should be
compared to the order function.
 

function array_join(array, seperator);
--------------------------------------

Concatenate all array elements to a string
 
