Someone
public text v1 · immutable$text = "hehe =D that was funny. Yeah I like tea to :P, though my cat can't have any =(";
$smilies = array(
'=D' => 'happy.png',
':P' => 'tounge.png',
'=(' => 'sad.png',
);
foreach( $smilies as $trigger=>$image ) {
$text = preg_replace( '/'.$trigger.'/', '<img src="'.$image.'" alt="'.$trigger.'" />', $text );
}