title: nl2br() function ads <br> if no character is entered after/in the next line
body: <p>I am using nl2br function with str_replace as follows:</p>
  
  <pre><code>$data = (!empty($_POST['content']))?nl2br($_POST['content']):null;
  $data_fix = str_replace(array("\r", "\n"), '', $data);
  </code></pre>
  
  <p>When I insert data into database next lines automatically receives a <code>&lt;br&gt;</code>. Okay fine. To 95% extent this is what I want. But if there is no character entered after the next line in <code>&lt;textarea&gt;</code> it still enters a <code>&lt;br&gt;</code>.</p>
  
  <p>Example:</p>
  
  <p>What I want:</p>
  
  <pre><code>Hello Stackoverflow!&lt;br&gt;I am new here.
  (new line space eliminated)
  </code></pre>
  
  <p>What I get:</p>
  
  <pre><code>Hellow Stactoverflow!&lt;br&gt;I am new here.&lt;br&gt;
  (new line space inserted)
  </code></pre>
  
  <p>Please help me solve this!</p>