Hello all i am working on a project where i need to have find any url/links/emails, preserve the line brakes,replace the special symbol with emotions and also wordwrap. so i was wondering that if all these things are possible with only a single function or not currently i am using this function for emotions
function emotions($text) {
$icons = array(
':)' => '<img src="smiles/smilee.png" class="icon_smile" title="smiling :)"/>',
':d' => '<img src="smiles/lol.gif" class="icon_smile" title="Laughing :d"/>',
';)' => '<img src="smiles/wink.png" class="icon_smile" title="Wink ;)"/>',
':p' => '<img src="smiles/tongue.png" class="icon_smile" title="Tounge :p"/>',
':(' => '<img src="smiles/sad.png" class="icon_smile" title="Sad face :("/>',
':o' => '<img src="smiles/shock.png" class="icon_smile" title="Shocking :o"/>',
':|' => '<img src="smiles/straight.png" class="icon_smile" title="straight :|"/>',
'<3' => '<img src="smiles/heart.png" class="heart" title="Heart <3"/>',
'::s' => '<img src="smiles/sexy.png" class="icon_smile" title="Sexy <s"/>',
':D' => '<img src="smiles/lols.gif" class="icon_smile" title="lol :D"/>',
':((' => '<img src="smiles/cry.gif" class="icon_smile" title="crying :(("/>',
':X' => '<img src="smiles/silent.gif" class="icon_smile" title="sealed lips :X"/>',
':B' => '<img src="smiles/bla.gif" style="width:29px;vertical-align:middle;" title="bla bla :B"/>',
':C' => '<img src="smiles/coll.gif" style="width:24px;vertical-align:middle;" title="coll me :C"/>'
);
return strtr($text, $icons);
}
?>
and i know that for wordwrap i can use the function wordwrap and for line brakes nl2br but i want all these in a single function please help me with this