indexOf
searches an array for a specified item and returns its position
Syntax
indexOf(val, start)
Returns
int position of the specified item
Parameters
- val (var)
- specified item
- start (integer)
- index to start from
Usage
var data = ['this', 'is', 'an', 'example', 'array',];
var test = data.indexOf('example');
echo(test);
// returns 3 as 'example' is the third index