title: Strip quotes in PHP for JSON output
body: <p>I have a string in PHP that contains both single and double quotes.</p>
  
  <p>I am trying to use this string in some JSON output. To do this I need to escape double quotes, slashes, newlines etc.</p>
  
  <p>I thought that addslashes() would do the job but it also escapes single quotes which causes the JSON to fail.</p>
  
  <p><strong>How can I escape all relevant special characters except for single quotes?</strong></p>