#!/usr/bin/env php xpath('//mapZone') as $mapZone) { $from = (string)$mapZone['other']; $to = (string)$mapZone['type']; list($to) = explode(' ', $to, 2); if (!isset($map[$from])) { $map[$from] = $to; } } ksort($map); echo "Writing to: $outputFile\n"; $f = fopen($outputFile, 'w'); fwrite($f, "