How to preserv php string to javascript
<p>I am trying to copy a string in a php array to localStorage and the string is a date in this format: 2016-06-15
But the string becomes calculated before stored.
How do I preserv it as a string?
Example:</p>

<pre><code>&lt;?php
  $test = array('2015-10-05','20151005');
  echo $test[0]."&lt;br&gt;";
  echo $test[1];
  echo '&lt;script&gt;localStorage["test1a"] = '.$test[0].';&lt;/script&gt;';
  echo '&lt;script&gt;localStorage["test2a"] = '.$test[1].';&lt;/script&gt;';
?&gt;
&lt;script&gt;localStorage["test1b"] = "2015-10-05";&lt;/script&gt;
&lt;script&gt;localStorage["test2b"] = "20151005";&lt;/script&gt;
</code></pre>

<p>This will output:</p>

<pre><code>2015-10-05
20151005
</code></pre>

<p>And in localStorage:</p>

<pre><code>test1a 2000
test1b 2015-10-05
test2a 20151005
test2b 20151005
</code></pre>