PHP REGEX: Problem with Smiley `:)` and `:))`

前端 未结 4 1080
别跟我提以往
别跟我提以往 2021-01-14 15:22

What I want


Hi! I want to replace :) to smile.png and :)) to laugh.png.

Th

4条回答
  •  悲哀的现实
    2021-01-14 16:09

    $string = str_replace(':))', 'laugh.png', $string);
    $string = str_replace(':)', 'smile.png', $string);
    

    php.net on str_replace: "If you don't need fancy replacing rules (like regular expressions), you should always use this function instead of ereg_replace() or preg_replace()."

提交回复
热议问题