Reputation: 23
I have a problem getting array values "lat" and "long" without going deeper by foreach function. Array:
array(1) {
["Berlin, Germany(All airports)"]=>
array(1) {
["Berlin Brandenburg Willy Brandt(BER)"]=>
array(2) {
["lat"]=>
string(9) "52.366667"
["lon"]=>
string(9) "13.503333"
}
}
}
Function:
foreach($results as $key => $val){
//here i want to reach lat and long without additional foreach loop
}
Thank you all for answers.
Upvotes: 0
Views: 1593
Reputation: 43552
foreach($results as $key => $val){
$temp = current($val); # fetch first value, which is array in your example
echo $temp['lat'];
}
Upvotes: 6