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

前端 未结 3 667
-上瘾入骨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 14:18

    To get around the issues with str_replace (space in
    being replaced with |) try strtr:

    echo strtr(trim($result['garment_type']), array(' '=>'|', '  '=>'

    '));

提交回复
热议问题