lastindexofArray

method returns the last index (position) of a specified value. starts at a specified index and searches from right to left. By default the search starts at the last element and ends at the first. Negative start values counts from the last element (but still searches from right to left).

Syntax

lastindexofArray

Returns

returns (integer) returns the last index (position) of a specified value. -1 if the value is not found.

Parameters

array_source (array)
source array
item (var)
The value to search for.
start (integer)
Optional. Where to start the search. Default is the last element (array.length-1).

Usage

example:

echo(objectToString(lastindexofArray([10,11,12,13,14,15], 12)));

output: 2