Madwormer - actually, </img> still is XHTML correct. All HTML tags must be closed, regardless of if you close it by doing a second tag or just by adding a slash onto the end.
Dan - needle as in "needle in the haystack" (or needle as in Halo's needler...maybe not 😉). On the PHP manual for str_replace, it says the parameters are "string needle, string haystack", so no, needle does not mean it's all on one line. What I meant is that you're specifying the entire array as something to look for, which means it probably will not work right. You need to do something like this: str_replace($smilies[0], $smiless, $test1). Better yet, use a loop:
for ($i = 0; $i <= sizeof($smilies); $i++)
{
str_replace($smilies[$i], $smiliess, $test1);
}