1. <?php
  2. // Source: http://us2.php.net/manual/en/function.nl2br.php#68993
  3. // Modified by Stephen (http://stephen.calvarybucyrus.org)
  4.  
  5. function nl2br($text)
  6. {return preg_replace("/\\r\\n|\\n|\\r/", "<BR>", $text);}
  7.  
  8. $a = "one\ntwo\r\nthree";
  9.  
  10. echo nl2br($a);
  11. ?>