I've been puzzuling over this for hours now. I've written the following code.
$smiliefile = fopen('smilies.csv', 'r');
while ($smilies = fgetcsv($smiliefile, 30)) {
$str1 = $smilies['1'];
$str2 = $smilies['0'];
$comment = str_replace($str1, "<img src=\"http://messenger.msn.co.uk/Resource/emoticons/{$str2}\" alt=\"{$str1}\">", $comment);
}
As far as I can tell this should work perfectly! This isn't the first time I've had a problem with str_replace. I can't seem to get it to work with a variable string. In other words I have to type a variable in quotes to get it to work. Eg:
str_replace("this string","that string","this is that string");
I'm running on a server with PHP 4.0.0.