php - replace string occurrences

后端 未结 3 656
-上瘾入骨i
-上瘾入骨i 2020-12-31 10:34

I have a string \"First line | second line | third line\" How can I replace | with a new line character?

I\'m trying to use

3条回答
  •  自闭症患者
    2020-12-31 11:07

    here it is

    str_replace('|',"\n",$string);
    

    when \n is placed in double qouted string it changes to a new line

提交回复
热议问题