$val) { foreach( $WeatherData[6] as $index=>$citycode ){ if( $val == $citycode ){ // $index is now the index of wheather for $val $wd2 = $WeatherData[2][$index] ; $wd3 = $WeatherData[3][$index] ; $wd4 = $WeatherData[4][$index] ; $wd5 = $WeatherData[5][$index] ; $wd6 = $WeatherData[6][$index] ; $SityWheather =<< EOD; // echo $SityWheather; } } } ?>

$wd4...$wd5

$wd6

$wd3