title: Stripping slashes in each value in an array
body: <p>I have an array of values I am getting from an SQL call but when I try to put it into a table in my web page, I get the error:</p>
  
  <pre><code>JSON.parse: bad escaped character at line 1 column 657 of the JSON data
  </code></pre>
  
  <p>I have realised that in the data, one of the rows has the data: INNO BROWN THOMAS TV\'S</p>
  
  <p>This is causing the error because of the escaping character, the large result set is coming back as an array and I need some sort of loop in php to remove these slashes and stop the error. What is the best way to do this? I have looked at the PHP Manual for <code>addslashes</code> and <code>stripslashes</code> and I have tried looping around an array to remove the slashes but nothing works.</p>
  
  <p>Any help or points in the right direction will be appreciated, thanks.</p>
  
  <pre><code>$prodSQL = new prodEnqSQL;
  $results = $prodSQL-&gt;getProdData($prodName, $prodType, $prodCode);
  function stripslashes_array($results){
      global $results;
      if(is_array($results)){
          foreach ($results as $key=&gt;$value){
              $value[$key] = stripslashes_array($value);
          }
  
      }else{
          return stripslashes($results);
      }
  
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/urThF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/urThF.png" alt="enter image description here"></a></p>