Multidimensional Array - Search for value and get the sub-array

function array_multi_search($needle,$haystack){
foreach($haystack as $key=>$data){

if(in_array($needle,$data))
return $key;
}
}
$key=array_multi_search(202,$clusters);
echo $key;
$array=$clusters[$key];

Try using this function. It returns the key of the $needle(202) in the immediate child arrays of $haystack(cluster). Not tested, so let me know if this works


$arrIt = new RecursiveArrayIterator($cluster);
$server = 202;

foreach ($arrIt as $sub){
    if (in_array($server,$sub)){
        $clusterSubArr = $sub;
        break;
        }
    }

$clusterX = array_search($clusterSubArr, $cluster);

$search=202;

$cluster=false;

foreach ($clusters as $n=>$c)
  if (in_array($search, $c)) {
    $cluster=$n;
    break;
  }

echo $cluster;