Lasso Soft Inc. > Home

[ array->findindex ]


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.

  • Syntax
  • Beginner

To find the index of a certain value within an array:

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


array(Red, Green, Aqua, Orange)

Recent Comments

No Comments found

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.

LassoSoft Inc. > Home



©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft