title: replacing new line characters with comma from given text
body: <p>Here I have tried to replace newline char with comma. I checked previous threads and acted accordingly but still no solution.</p>
  
  <pre><code>$letters = '#\s+#';
  $rep   = ',';
  $output  = str_replace($letters, $rep, trim($text));
  echo $output;
  </code></pre>
  
  <p>Link to demo : <a href="http://ideone.com/DoFOSc" rel="nofollow">http://ideone.com/DoFOSc</a></p>