} if (preg_match('@[^a-zA-Z.\\-\\/ \']@', $name)) { // error_log("Foreign characters: $name"); continue; } $name_variants = generate_name_variants($name, $country_name); foreach ($name_variants as $name_variant) { $name_variant = strtolower(trim($name_variant)); if (!isset($name_to_state_code[$name_variant])) { $name_to_state_code[$name_variant] = array(); } $name_to_state_code[$name_variant][$state_code] = true; } } } $country_bounding_boxes[$country_code] = $input_osm_ways->calculate_bounding_box(); } $php_output_handle = fopen($php_output, "w") or die("Couldn't open {$php_output}\n"); fwrite($php_output_handle, '$state_code_accepted_values = array(' . "\n"); foreach ($state_code_info as $code => $info) { fwrite($php_output_handle, ' "' . $code . '",' . "\n"); } fwrite($php_output_handle, ');' . "\n\n"); fwrite($php_output_handle, '$state_code_to_country = array(' . "\n"); foreach ($state_code_info as $code => $info) { fwrite($php_output_handle, ' "' . $code . '" => "' . $info['country_code'] . '",' . "\n"); } fwrite($php_output_handle, ');' . "\n\n"); fwrite($php_output_handle, '$state_name_to_codes_translation_table = array(' . "\n"); foreach ($name_to_state_code as $name => $codes) { fwrite($php_output_handle, ' "' . $name . '",' . "\n");