Does anyone know how I would go about searching through an array for repeated values and return the one with the smaller index? For example:

$array[0]= "timmy";
$array[1] = "joe";
$array[2] = "elmo";
$array[3] = "clarissa";
$array[4] = "joe";

I need a function that will return "1" if I do findrepeatlowerindex("joe");

In addition, I would like it to not be case sensitive ( :o ), if at all possible.

So

$array[0]= "timmy";
$array[1] = "joe";
$array[2] = "elmo";
$array[3] = "clarissa";
$array[4] = "JoE";

findrepeatlowerindex("joE"); would return "1", too.

Any suggestions on how I could go about doing this? Or if you are really cool you could write the function for me :D.

Thanks,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.