rendered paste body<?header('Content-type: text/xml');echo '<?xml version="1.0" encoding="ISO-8859-1"?>';error_reporting(0);$NumStores = 2;$Store[0] = array ('Canada','Ontario','LCBO','Some Address');$Store[1] = array ('Canadaa','Ontario','Beer Store','Some Address');$CountryAdded = array ();//<state name="'.$State[1].'"><store name="'.$Store[1].'"><address>whatever</address></store></state></country>');for ($i=0; $i < $NumStores; $i++) { for ($a=0; $a < 4; $a++) { if ($a == 0) { $CountryElements = count($CountryAdded); if (count($CountryAdded) > 0) { for ($b=0; $b < $CountryElements; $b++){ if ($CountryAdded[$b] == $Store[$i][$a]) { echo "startState"; } else { echo '<country name="'.$Store[$i][$a].'">'; array_push($CountryAdded, $Store[$i][$a]); } } }else { echo '<country name="'.$Store[$i][$a].'">'; array_push($CountryAdded, $Store[$i][$a]); } echo '</country>'; } }}?>