title: Force json_encode to create strings of numeric values in a flat array
body: <p>I have to json_encode a PHP array to a JavaScript array. Unfortunately, the jQuery library I am using will not properly process that array if it contains integers instead of strings.</p>
  <p>Most of the time, this will produce proper array containing only strings:</p>
  <pre><code>json_encode($data)
  </code></pre>
  <p>Even if <code>$data</code> contains just numbers, I usually get this:</p>
  <pre><code>[&quot;3&quot;,&quot;7&quot;,&quot;8&quot;]
  </code></pre>
  <p>Sometimes though, I get results like this (note the zero):</p>
  <pre><code>[&quot;9691&quot;,&quot;1792&quot;,&quot;26&quot;,&quot;1&quot;,&quot;4&quot;,&quot;15&quot;,0,&quot;1&quot;]
  </code></pre>
  <p>or this</p>
  <pre><code>[16171,15470,10390,7585]
  </code></pre>
  <p>(Note, this is obviously different data to illustrate what's going on). I need to enforce json_encode to treat the array values as strings. I know there's the opposite option JSON_NUMERIC_CHECK which enforces numbers. Does the equivalent really not exist? Seems my only option is to process the array again on the JavaScript end, which, while possible, somewhat breaks the encapsulation of my objects.</p>