I have this if:
foreach ($new_array_adm2 as $key => $val) {
if ($val['feature code'] === 'ADM3' )
{
$test = "".$val['country code']." ".$val['admin1 code']." ".$val['admin2 code']."";
}
echo $test;
}
Why $test doesn’t work here?
Array:
Array
(
[0] => Array
(
[geonameid] => 6358177
[name] => España
[asciiname] => Alajar
[alternatenames] =>
[latitude] => 37.8394400
[longitude] => -6.6507900
[feature class] => A
[feature code] => ADM3
[country code] => ES
[cc2] =>
[admin1 code] => 51
[admin2 code] => H
[admin3 code] => 21001
[admin4 code] =>
[population] => 46505963
[elevation] => 0
[gtopo30] => 350
[timezone] => Europe/Madrid
[modification date] => 2015-10-15
[iso_alpha2] => ES
[iso_alpha3] => ESP
[iso_numeric] => 724
[fips_code] => SP
[capital] => Madrid
[areainsqkm] => 504782
[continent] => EU
[tld] => .es
[currency] => EUR
[currencyName] => Euro
[Phone] => 34
[postalCodeFormat] => #####
[postalCodeRegex] => ^(d{5})$
[geonameId] => 0
[languages] => 2510769
[neighbours] => AD,PT,GI,FR,MA
[equivalentFipsCode] =>
)
[1] => Array
(
[geonameid] => 2521964
[name] => España
[asciiname] => Aljaraque
[alternatenames] => Aljaraque
[latitude] => 37.2698900
[longitude] => -7.0231300
[feature class] => P
[feature code] => PPLA3
[country code] => ES
[cc2] =>
[admin1 code] => 51
[admin2 code] => H
[admin3 code] => 21002
[admin4 code] =>
[population] => 46505963
[elevation] => 0
[gtopo30] => 30
[timezone] => Europe/Madrid
[modification date] => 2012-03-04
[iso_alpha2] => ES
[iso_alpha3] => ESP
[iso_numeric] => 724
[fips_code] => SP
[capital] => Madrid
[areainsqkm] => 504782
[continent] => EU
[tld] => .es
[currency] => EUR
[currencyName] => Euro
[Phone] => 34
[postalCodeFormat] => #####
[postalCodeRegex] => ^(d{5})$
[geonameId] => 0
[languages] => 2510769
[neighbours] => AD,PT,GI,FR,MA
[equivalentFipsCode] =>
)
[2] => Array
(
[geonameid] => 6358179
[name] => España
[asciiname] => Almendro, El
[alternatenames] =>
[latitude] => 37.5743800
[longitude] => -7.3761300
[feature class] => A
[feature code] => ADM3
[country code] => ES
[cc2] =>
[admin1 code] => 51
[admin2 code] => H
[admin3 code] => 21003
[admin4 code] =>
[population] => 46505963
[elevation] => 0
[gtopo30] => 172
[timezone] => Europe/Madrid
[modification date] => 2015-10-15
[iso_alpha2] => ES
[iso_alpha3] => ESP
[iso_numeric] => 724
[fips_code] => SP
[capital] => Madrid
[areainsqkm] => 504782
[continent] => EU
[tld] => .es
[currency] => EUR
[currencyName] => Euro
[Phone] => 34
[postalCodeFormat] => #####
[postalCodeRegex] => ^(d{5})$
[geonameId] => 0
[languages] => 2510769
[neighbours] => AD,PT,GI,FR,MA
[equivalentFipsCode] =>
)
)