title: Remove Backslash Escaping in Javascript Array
body: <p>I have a pretty complex problem.</p>
  
  <p>I'm using PHP to parse a CSV file to an array and then</p>
  
  <pre><code>var array = &lt;?php echo json_encode( $array ) ?&gt;;
  </code></pre>
  
  <p>to pass it to the Javascript <code>array</code>.</p>
  
  <p><code>array</code> is 2-dimensional, like so:</p>
  
  <pre><code>var array = [["\/\\ssa","14104","26","2113","0","867","28083","15","43695"],
               ["Yee","8661","24","2215","0","991","25245","15","49086"],...]
  </code></pre>
  
  <p>Now sometimes there seems to be a problem with backslash escapes in the username when it is structured like this:</p>
  
  <p>["username\","sth","sth",...], so when the username ends with a backslash \ .</p>
  
  <p>The output will be:</p>
  
  <pre><code>username", sth, sth, ...
  </code></pre>
  
  <p>But this is only the first element of the sub-array, the other 8 places are empty.</p>
  
  <p>I have already tried to fix it with a loop replace, but I don't know how to add \" as search value. Is this impossible to do in JS since \" always escapes? Already tried charAt() to compare the last character with the backslash, but no success. Do I have to replace it before passing it to JS, in PHP?
  The Parse function is this, if it's important:</p>
  
  <pre><code>&lt;?php&gt;
  
  $url = "data.csv";
  $csvData = file_get_contents($url);
  $lines = explode(PHP_EOL, $csvData);
  $array = array();
  foreach ($lines as $line) {
  $array[] = str_getcsv($line);
  
  ?&gt;
  </code></pre>
  
  <p><b>Here a JSfiddle you can play with:</b> <a href="https://jsfiddle.net/cLmbe0qf/" rel="nofollow">https://jsfiddle.net/cLmbe0qf/</a></p>