PHP regex replace white space by   if it is following single letter

前端 未结 4 1304
无人共我
无人共我 2021-01-14 02:45

I have user defined string (html formated string to be saved and used in web) and need to find a way to replace each white space which is right after a single letter by

4条回答
  •  孤街浪徒
    2021-01-14 03:22

    To preserve the white spaces and line breaks for a text originating from a database:

    echo nl2br(str_replace(' ',' ', stripslashes( database_string )));
    

提交回复
热议问题