I'm making my own forum software. Well its normal to have smileys in your forum.
So i made an array with all the smileys and putted them in a function:
function si_ubb($string){
$smileys = array(
'0<:)' => 'angelnot.gif',
'>:(' => 'angry.gif',
':@' => 'blush.gif',
':*' => 'cencored.png',
':?' => 'confused.gif',
';(' => 'cry.png',
':D' => 'grin.gif',
':)' => 'happy.gif',
':|' => 'hmm.png',
'0:)' => 'hypocrite.gif',
':x:' => 'lock.gif',
'<3' => 'love.gif',
'8)' => 'rolleyes.gif',
':(' => 'sad.png',
'|)' => 'shifty.gif',
'O_o' => 'shock.gif',
'8)' => 'sunglasses.gif',
'^_^' => 'sweatingbullets.gif',
':p' => 'tongue.gif',
':P' => 'tongue.gif',
';)' => 'wink.gif',
'>.<' => 'wry.gif',
'XD' => 'wry.gif',
'xD' => 'wry.gif'
);
foreach($smileys as $code => $image){
$string = str_replace($code, $image, $string);
}
return $string;
}
But, ehm, when i do this now:
echo si_ubb('0<:)');
It gives this?
0<
But how? And why? Why isn't it showing the right smiley?
Greetings