You are here

function _weather_parse_icao in Weather 5

Same name and namespace in other branches
  1. 5.6 weather_parser.inc \_weather_parse_icao()
  2. 6.5 weather_parser.inc \_weather_parse_icao()
  3. 7 weather_parser.inc \_weather_parse_icao()

Extract the ICAO code

ICAO = International Civil Aviation Organization, this is a four letter airport code, e. g. EDDH

Parameters

string Raw METAR data to parse:

array Parsed METAR data, will be altered:

1 call to _weather_parse_icao()
weather_parse_metar in ./weather_parser.inc
Parses a raw METAR data string

File

./weather_parser.inc, line 78

Code

function _weather_parse_icao($metar_raw, &$metar) {
  if (preg_match('/^([A-Z]{4}|K[A-Z0-9]{3})$/', $metar_raw) and !isset($metar['icao'])) {
    $metar['icao'] = $metar_raw;
  }
}