title: Nested PHP arrays to json
body: <p>So my code here:</p>
  
  <pre><code>    $featurecollection = ("FeatureCollection");
  
          $test[] = array (
          "type" =&gt; $featurecollection,
          $features[] = array($images)
  
      );
  
     file_put_contents($cache,json_encode($test));
  </code></pre>
  
  <p>results in the following json:</p>
  
  <pre><code>[
   {
    "type":"feature",
    "0":[
       [
          {
             "title":"some title",
             "src":"value",
             "lat":"value",
             "lon":"value"
          },
          {
             "title":"some title",
               ...
  </code></pre>
  
  <p>But I need to nest things differently and I'm perplexed on how the php array should be constructed in order to get a result like:</p>
  
  <pre><code>{
  "type":"FeatureCollection",
   "features":[
  
    {
       "type":"Feature",
       "geometry":{
          "coordinates":[
             -94.34885,
             39.35757
          ],
          "type":"Point"
       },
       "properties":{
          "latitude":39.35757,
          "title":"Kearney",
          "id":919,
          "description":"I REALLY need new #converse, lol. I've had these for three years. So #destroyed ! :( Oh well. Can't wait to get a new pair and put my #rainbow laces through. #gay #gaypride #bi #proud #pride #colors #shoes #allstar #supporting ",
          "longitude":-94.34885,
          "user":"trena1echo5",
          "image":"http://images.instagram.com/media/2011/09/09/ddeb9bb508c94f2b8ff848a2d2cd3ece_7.jpg",
          "instagram_id":211443415
       }
    },
  </code></pre>
  
  <p>What would the php array look like for that? I'm thrown off by the way everything is nested but still has a key value.</p>