These functions searches the array for the specified object and return the positions of all occurrence of this values.

ArrayFindAll( array=array, value_or_closure=any );

Returns: Array

Argument Description
array, required

The array to search in

any, required

The value to find or a closure/function that gets every value of the array as input and returns true if the given value is right.

Alias: object, value, closure, function, udf, callback


Find all occurrences of string in array

fruitArray = ['apple', 'kiwi', 'banana', 'orange', 'mango', 'kiwi'];
favoriteFruits = arrayFindAll(fruitArray,'kiwi');
dump(favoriteFruits); // [2,6]

See also