What I want
Hi! I want to replace :)
to smile.png
and :))
to laugh.png
.
Th
str_replace(array(":))", ":)"), array("laugh.png", "smile.png"), $string);
The order is important.
For :) – (:\)(?!\)))
Then
For :)) – (:\)\))
$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()."
Why don't you do a simple text replace?
First :))
to laungh.png
, then :)
to smile.png