The [array->findindex] method searches the array for the parameter and returns an array of indices for those elements which match. Accepts a single parameter of any data type.
If the array contains any pair values, only the first part of the pair is compared with the parameter of the [array->findindex] method.
If no elements in the array match the parameter to the [array->findindex] method then an empty array is returned.
Note: This method returns the same results as the [array->findposition] method except that it does not accept an optional offset parameter.
Use the [array->findindex] method. This tag can be used to locate the index of a particular value within an array so that element can be deleted or changed. In the following example the index for the item Blue is found and the value of that element is changed to Aqua.
var( myArray =array('Red', 'Green', 'Blue', 'Orange') ) var( myIndex = $myArray->findindex('Blue')->Get(1) ) $myArray->get($myIndex) = 'Aqua' //output myArray $myArray
array(Red, Green, Aqua, Orange)
Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.