...

View Full Version : PHP Smilie Function



Zangeel
05-09-2009, 10:59 AM
This function will convert smilie shortcuts into smilie images.



<?php

/**
* @author Zangz
* @copyright 2009
*/

function Smiles($text) {

$path = "http://www.yoursite.com/path/to/emos/";
$arr = array(
":D" => $path. "biggrin.gif", //biggrin.gif is the emo image name
);

foreach ($arr as $smile => $paths) {

$text = str_ireplace($smile, '<img src="'.$paths.'" style="vertical-align:middle" />', $text);

}

return $text;

}

$txt = "Lalala I win! :D hahaha"; //example text
echo Smiles($txt);


?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum