At least you call preg_replace() in a wrong way. This functions returns the modified text, so you must do
PHP Code:
$txt = preg_replace(...);
Next, you also must escape slashes, backslashes and round brackets:
PHP Code:
$txt = preg_replace("/:\)/", ... , ...);
$txt = preg_replace("/:\\/", ... , ...);
Also it's recommended to use str_replace() in this case because you don't do anyithing special with your source string. But from another side you can benefit from using preg_replace in following way:
PHP Code:
$mathces = array(
'/:angry:/',
'/:\)/',
// whatever else
);
$replaces = array(
'<img ....>',
'<img ....>',
// more images
);
$txt = preg_replace($matches, $replaces, $txt);
Hope that helps.
|