title: How do I `json_encode()` keys from PHP array?
body: <p>I have an array which prints like this</p>
  
  <pre><code>Array ( [0] =&gt; 1691864 [1] =&gt; 7944458 [2] =&gt; 9274078 [3] =&gt; 1062072 [4] =&gt; 8625335 [5] =&gt; 8255371 [6] =&gt; 5476104 [7] =&gt; 6145446 [8] =&gt; 7525604 [9] =&gt; 5947143 )
  </code></pre>
  
  <p>If I <code>json_encode($thearray)</code> I get something like this</p>
  
  <pre><code>[1691864,7944458,9274078,1062072,8625335,8255371,5476104,6145446,7525604,5947143]
  </code></pre>
  
  <p>Why the name is not encoded (e.g 0, 1 , 2 , 3 etc) ? and how should I do to make it appear in the json code?
  the full code is below </p>
  
  <pre><code>  $ie = 0;
    while($ie   10)
    {
      $genid = rand(1000000,9999999);
       $temp[$ie] = $genid ;
       $ie++;
       }
       print_r($temp);
  
      $temp_json = json_encode($temp);
      print_r($temp_json);
  </code></pre>