# Neat Little Array Searcher Function

**URL:** <https://forum.kirupa.com/t/neat-little-array-searcher-function/243604>\
**Category:** open source\
**Created:** [November 8, 2007, 8:04pm UTC](https://forum.kirupa.com/t/neat-little-array-searcher-function/243604 "2007-11-08T20:04:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![GrndMasterFlash](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@GrndMasterFlash](https://forum.kirupa.com/u/GrndMasterFlash)\
**Post date:** [November 8, 2007, 8:04pm UTC](https://forum.kirupa.com/t/neat-little-array-searcher-function/243604/1 "2007-11-08T20:04:17Z")

</div>

i just wrote this and thought others out there would like to have a function that finds an objects place in an array.

```auto

//BY: Dononvan Hubbard 11-7-07
//arrName is the arrays name, and item is what your looking for in the array
function searchArray(arrName:Array, item:*):* {
    //loop through the array
    for (var s:int = 0; s < arrName.length; s++) {
        //see if the array items matches the item your looking for
        if (arrName[s] == item) {
            var arrValue = s;
            //return your items place in the array
            return arrValue;
        }
    }
}

```

hope this helps some of you guys :sc:
