title: php json_encode not escaping new lines
body: <p>I am facing some issue with json_encode.</p>
  
  <p>when i json_encode an array having new lines it is not escaping new lines instead it's removing \ and keeping n.</p>
  
  <pre><code>ex: $array = array('name'=&gt; "some text \n\r text");
  $results = json_encode($array);
  </code></pre>
  
  <p>it is saving <code>some text nr text</code> in database .</p>
  
  <p>i am using <code>php 5.3.8</code>. </p>
  
  <p><strong>edit:</strong></p>
  
  <p>This is my original code i am using</p>
  
  <pre><code>$attr = array();
  for($i=0; $i &lt; count($_POST['key']); $i++){
      $attr[$_POST['key'][$i]] = $_POST['value'][$i];
  }
  echo json_encode(array('custom' =&gt; $attr));
  </code></pre>
  
  <p>these <code>POST</code> values getting from form.</p>