# Finding most often occurring word in an array

**URL:** <https://forum.kirupa.com/t/finding-most-often-occurring-word-in-an-array/307368>\
**Category:** Uncategorized\
**Created:** [April 2, 2010, 7:22am UTC](https://forum.kirupa.com/t/finding-most-often-occurring-word-in-an-array/307368 "2010-04-02T07:22:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eternalnoob](https://avatars.discourse-cdn.com/v4/letter/e/3da27b/32.png) [@eternalnoob](https://forum.kirupa.com/u/eternalnoob)\
**Post date:** [April 2, 2010, 7:22am UTC](https://forum.kirupa.com/t/finding-most-often-occurring-word-in-an-array/307368/1 "2010-04-02T07:22:58Z")

</div>

Hi,  
I’m getting confused thinking this through. I have an array with single words (strings) as each value. I want to find out which word occurs the most often in the array. I’m using strcasecmp to do the comparison, but I’m getting confused visualizing the model for what I want to do. I know I have to compare each word to each other word in the array, but how do I keep a count of which words are the same and ultimately which one occurs the most often? I’m thinking I need to use a for or foreach loop but, as I say, I’m confusing myself thinking about it. Any help most appreciated!

EN
