PRIOR v11
The PRIOR
method returns the subscript that precedes a specified subscript in a collection. The method takes a single argument; the subscript
that you are testing for. The syntax is:
collection
is the name of the collection.
If the subscript specified does not have a predecessor, PRIOR
returns NULL
. If the specified subscript is greater than the last subscript in the collection, the method returns the last subscript. If you specify a NULL
subscript, PRIOR
does not return a value.
The following example returns the subscript that precedes subscript 100
in the associative array, sparse_arr: