$pos=-1; for ($i=0;($i<count($all_Companies[0])) && ($pos==-1);$i++){ if (strstr($url,$all_Companies[$i][0])) $pos=$i; }