array.contains Function |
The array.contains function may be used to determine if a given expression is present in an array.
array.contains(ident, expr);
ident | Required. The array |
expr | Required. An expression |
The following example creates a new array initialized with two elements: '1' and '2'.
We then append a third element, '3', to the end of the array using the array.add function.
$arr = array.new(1, 2); PRINT $arr; /* [1,2] */ PRINT array.contains($arr, 2); /* false */ array.add($arr, 3); PRINT $arr; /* [1,2,3] */ PRINT array.contains($arr, 2); /* true */
True if epxr is equal to one or more elements in the ident array. Otherwise returns false.
array.last - get the last element of an array
array.get_at - retrieve the data at a specified index of an array
length - get the number of elements in an array