A Scripting Language for Web, Linux and Windows

A Scripting Language for Web, Linux and Windows

Array functions

The following array functions are supported. The array functions are compatible with theire PHP pendants. See also Datatypes and Datatype functions.

Function/Arguments Return Description
assign (mixed& var1...) undefined The special language construct assign() is the V1 pendant to list() in PHP and assign one or more variables with corresponding array values. Usage: assign (var1, var2, varN) = array ("Value1", "Value2", "Value3");
count (array &list) number Return count of elements in array list .
array_push (array &list, mixed value) number Push a value to array list and return the next free index.
array_pop (array &list) mixed Pop a value from array list and return.
array_key_exists (array &array, string key) bool Return true if a key exists in array. In difference to isset () also true is returned if the value of key is null.
in_array (mixed value, array &array, bool strict=false) bool Same as PHP function in_array (). Search the given value in array. If strict = true then the datatype must be equal. If value was found in array then true is returned.
array_search (mixed value, array array, bool strict=false) string Same as in_array (), but return the key of the found value. If value is not found false is returned.
array_merge (mixed array1, array array2...) array Same as PHP function array_merge (). Merge two ore more arrays together. Alphanumeric keys in previous arrays will be be overwritten from next arrays. Number keys (indexes) will be appended and reorganized beginning from 0. The merged array is returned.
array_keys (array array) array Return keys of array as list.
array_values (array array) array Return values of array as list.
array_slice (array array, number offset [, number length]) array Same as PHP function array_slice (). Extract a slice of the array from offset with optional length and return. If length is not specified then the rest of the array is returned.
array_splice (array &array, number offset [, number length, mixed replace]) array Same as PHP function array_splice (). Remove a portion of the array with optional length and replace it with something else. If length is not set then the rest of the array will be removed. If replace is not set then the portion is only removed. Note: Parameter array is given as reference to a variable which will be spliced. The return value is the sliced array, same as in function array_slice().
array_flip (array array) array Swap the keys and the values of the array an return. If value is not a number or string it will be irgnored and a warning is shown.
array_reverse (array array, preserveKeys=false) array Reverse the direction of entries in the array and return. If preserveKeys = true then the keys are preserved, otherwise new indexes beginning from 0 are calculated.

Sort functions

Function/Arguments Return Description
sort (array& array) true Sort array by values in ascending order with changing of keys. New indexes are calculated.
rsort (array& array) true Sort array by values in descending order with changing of keys. New indexes are calculated.
asort (array& array) true Sort array by values in ascending order without changing of keys.
arsort (array& array) true Sort array by values in descending order without changing of keys.
ksort (array& array) true Sort array by keys in ascending order without changing of keys.
krsort (array& array) true Sort array by keys in descending order without changing of keys.
usort (array& array, string cmpFunc) true Sort array by values with own comparison function with changing of keys. The cmpFunc get two arguments and must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. New indexes are calculated.
uasort (array& array, string cmpFunc) true Sort array by values with own comparison function without changing of keys. The cmpFunc get two arguments and must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.

back to Home

V1 Version 0.96 - Documentation generated Wed, 03 Jan 2024 12:21