#!/usr/bin/env php xpath('//mapZone[@territory=001]') as $zone) { $from = (string) $zone['other']; $to = (string) $zone['type']; // then there can also be multiple timezone, so we take the first one $to = explode(" ",$to)[0]; $map[$from] = $to; } ksort($map); $export = var_export($map,true); $script = basename(__FILE__); $date = gmdate('c'); file_put_contents($output, <<