title: Force PHP json_encode() to encode indexes as strings
body: <p>I have a an array setup as follows:</p>
  
  <pre><code>$myArray = array();
  $myArray[] = "New array item 1";
  $myArray[] = "New array item 2";
  $myArray[] = "New array item 3";
  </code></pre>
  
  <p>When I run json_encode() on it it outputs the following:</p>
  
  <pre><code>["New array item 1","New array item 2","New array item 3"]
  </code></pre>
  
  <p>What I want is for the function to encode the indexes as strings:</p>
  
  <pre><code>{"0":"New array item 1","1":"New array item 2","2":"New array item 3"}
  </code></pre>
  
  <p>So that later I can remove say the first item without affecting the index of the second.</p>
  
  <p>Is there an easy way to do this?</p>