-4

Could anyone explain how does structure of that array look like?

$result['results'][0]['geometry']['location']
MattBuk
  • 25
  • 1
  • 6

2 Answers2

1

it is

$result = array(
   'results'=> array(
      array(
         'geometry' => array(
            'location' => 'SOME VALUE'
         )
      )
   )
)
Guns
  • 2,678
  • 2
  • 23
  • 51
0

You can use var_dump and / or print_r to view the structure of an array.

<?php
    $result['results'][0]['geometry']['location'] = 1;
    echo "<pre>";
    var_dump($result);
    print_r($result);
    echo "</pre>";
?>

Outputs

array(1) {
  ["results"]=>
  array(1) {
    [0]=>
    array(1) {
      ["geometry"]=>
      array(1) {
        ["location"]=>
        int(1)
      }
    }
  }
}

Array
(
    [results] => Array
        (
            [0] => Array
                (
                    [geometry] => Array
                        (
                            [location] => 1
                        )
                )
        )
)
Mario Werner
  • 1,771
  • 14
  • 24