title: Encode array to JSON string without array indexes
body: <p>I'm sending a JSON string to the database from Javascript, with the following syntax:</p>
  
  <pre><code>["Product1","Product2","Product3"]
  </code></pre>
  
  <p>Before I simply put this data in my database without decoding it in php, and it worked without problems when using it again after retreival.</p>
  
  <p>However now I need to make a few changes to the data in the string, so I decode it in PHP, which will result in an array like so:</p>
  
  <pre><code>print_r(json_decode($_POST["myjsonstring"]));
  //outputs
  //Array
  //(
  //    [0] =&gt; Product1
  //    [2] =&gt; Product2
  //    [3] =&gt; Product3
  //)
  </code></pre>
  
  <p>My problem is that when I encode this array back to JSON, the string's format will be the following:</p>
  
  <pre><code>{"0":"Product1","2":"Product2","3":"Product3"}
  </code></pre>
  
  <p>I need the encoded string to be the same as my javascript creates, so without the array indexes. Is there an easy way to do this?</p>