How to wrap each new line in textarea with li tags? PHP

前端 未结 3 1670
说谎
说谎 2021-02-10 18:15

I have a textarea form field where users will put URL\'s separated by a new line. Would it be possible to wrap each line from this textarea field with < li > tags?

So

3条回答
  •  抹茶落季
    2021-02-10 18:19

    And what about something like this

    echo preg_replace('/^(.+)(\s*)$/m', '
  • $1
  • ', $text);

    Output will be anything like this (not nice, but usefull):

  • dsadsa
  • dsdsa
  • dsadsad
  • dsadsadsad
  • vcxvxcvxvcxvcx
  • fdsfdsfdsfs
提交回复
热议问题