I am just finishing off a really basic chat system and I am having problems with a function I have made:
It simply does not work. There is no change to the $test value. Does anyone know why?
Code:
function smiley($text) {
$smilies = array(
':)' => "<img src='emotions/happy.gif' />",
':D' => "<img src='emotions/vhappy.gif' />",
':(' => "<img src='emotions/sad.gif' />",
';)' => "<img src='emotions/winking.gif' />",
'>)' => "<img src='emotions/evil.gif' />",
'>(' => "<img src='emotions/mad.gif' />",
);
$text = str_replace( array_keys($smilies), array_values($smilies), $text );
return $text;
}
Comment