How to replace all occurrences of two substrings with str_replace()?

前端 未结 3 715
-上瘾入骨i
-上瘾入骨i 2021-01-28 13:20

Currently I have this code which replaces any double space with a
.

It works as expected:



        
3条回答
  •  醉酒成梦
    2021-01-28 13:57

    You can pass arrays to str_replace

    $what[0] = '  ';
    $what[1] = ' ';
    
    $with[0] = '

    '; $with[1] = '|'; str_replace($what, $with, trim($result['garment_type'] ) )

提交回复
热议问题