preg_replace list items

Discussion in 'PHP' started by alphacooler, Oct 3, 2006.

  1. #1
    I would like to wrap <li></li> tags around each newline.

    How would I go about this?
     
    alphacooler, Oct 3, 2006 IP
  2. harsh789

    harsh789 Member

    Messages:
    29
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    #2
    str_replace("\r\n", "</li><li>", "<li>".$instr."</li>");
    PHP:
     
    harsh789, Oct 4, 2006 IP