Capturing new line character

Discussion in 'PHP' started by NoamBarz, Aug 12, 2009.

  1. #1
    I've been having trouble capturing new line characters before inserting strings into my db.

    the following did not work:

    str_replace("\n", "<br/>", $string);
    htmlentities($string, ENT_QUOTES);
    htmlspecialchars ($string);

    any suggestions?
     
    NoamBarz, Aug 12, 2009 IP
  2. NoamBarz

    NoamBarz Active Member

    Messages:
    242
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Sorry, I got it. Simply use str_replace("\r\n", "<br/>", $str);
     
    NoamBarz, Aug 13, 2009 IP