I have a multidimensional array that I would like to loop through and print the values that are stored in the array. This is the end result I am looking to achieve
{ "lat": 52.4469601, "lon": -1.93685532},
{ "lat": 52.44332417, "lon": -1.9426918},
{ "lat": 52.43987106, "lon": -1.9329071}
How would I go about printing the values like this? Currently this is how I am printing the whole array:
$enc = 'NTIuNDQ2OTYwMSwtMS45MzY4NTUzMnw1Mi40NDMzMjQxNywtMS45NDI2OTE4fDUyLjQzOTg3MTA2LC0xLjkzMjkwNzF8NTIuNDQ1NDk1MywtMS45MjU4MjYwN3w';
$decoded = base64_decode($enc);
$trim = trim($decoded, '|');
$data = explode('|', $decoded);
$out = array();
$step = 0;
$last = count($data);
$last--;
foreach( $data as $key => $item ) {
foreach (explode(',', $item) as $value) {
$out[$key][] = $value;
}
}
echo "<pre>";
print_r( $out );
echo "</pre>";
And the output looks like:
Array
(
[0] => Array
(
[0] => 52.4469601
[1] => -1.93685532
)
[1] => Array
(
[0] => 52.44332417
[1] => -1.9426918
)
[2] => Array
(
[0] => 52.43987106
[1] => -1.9329071
)
[3] => Array
(
[0] => 52.4454953
[1] => -1.92582607
)
)