If you search a key position in an associative array (keys are uniques), i suggest this function :

<?php
public function getKeyPositionInArray($haystack, $keyNeedle)
{
    $i = 0;
    foreach($haystack as $key => $value)
    {
        if($key == $keyNeedle)
        {
            return $i;
        }
        $i++;
    }
}
?>


___
As seen in :
http://fr2.php.net/manual/fr/function.array-search.php#94598