array.range Function |
The array.range function selects a number of consecutive elements from a specified array. The selected elements are returned in an array. The order of the elements is not altered.
Tip |
---|
All Alchemy arrays use zero-based indexing. |
array.range(ident, idx, len);
ident | An array identifier |
idx | The index of the ident array to start selection from |
len | The number of elements to select |
The following example creates a new array. We then use the array.range function to select three elements from the array, starting at the third (index 2) element.
$arr = array.new("T","E","L","O","G","I","S"); PRINT array.range($arr, 2, 3);
Output:
[L,O,G] |
array.first - get the first element of an array
array.flatten - expand elements of an array that are, themselves, arrays
array.join - convert an array to a string by joining all the elements
array.last - get the last element of an array
array.new - create a new array
array.pop - remove and return the element at the head of the array
array.get_at - retrieve the data at a specified index of an array
length - get the number of elements in an array