title: Json array of objects in php
body: <p>this is the json that my code produces</p>
  
  <pre><code>{
  "aaa":1,
  "b":2,
  "c":3,
  "d":4,
  "e":5,
  "fff":{"a":11111,"b":222222,"c":33333,"d":444454,"e":55555555}
  }
  </code></pre>
  
  <p>and this is the code</p>
  
  <pre><code>&lt;?php
  $c = array('a' =&gt; 11111, 'b' =&gt; 222222, 'c' =&gt; 33333, 'd' =&gt; 444454, 'e' =&gt; 55555555 );
  $arr = array('aaa' =&gt; 1, 'b' =&gt; 2, 'c' =&gt; 3, 'd' =&gt; 4, 'e' =&gt; 5 , 'fff'=&gt;$c);
  echo json_encode($arr);
  ?&gt;
  </code></pre>
  
  <p>but I want to have some structure like this</p>
  
  <pre><code>{
  "aaa":1,
  "b":2,
  "c":3,
  "d":4,
  "e":5,
  "fff":{"a":11111,"b":222222,"c":33333,"d":444454,"e":55555555},
  "last":[
        {
          "id": 8817,
          "loc": "NEW YORK CITY"
        },
        {
          "id": 2873,
          "loc": "UNITED STATES"
        },
        {
          "id": 1501,
          "loc": "NEW YORK STATE"
        }
      ]
  }
  </code></pre>
  
  <p>I am new in json and php and I need this fast so I do not have time to read about this json structure... So please if someone know how to add this last element please provide some php code. </p>
  
  <p>Thanks,</p>