Jump to content

Archived

This topic is now archived and is closed to further replies.

Mortier

Smiley parsing, case sensitive -> case insensitive

Recommended Posts

Hello people, I use the following program to make smilies-images out of shortcuts like :) and :P.

[code]<?
function makeSmiley($content)
{
//bij het toevoegen van een smiley, let wel dat de eerste smiley 0.gif (of 0.jpg) wordt.
$smilies = array
(
"", //0
":)", //1
":P", //etc
":D",
":(",
";)",
":S",
":'(",
":@",

);
//$replace = de key
//$smiley = de waarde, bijv. :)
foreach($smilies as $id => $smiley)
{
$replace = '<img src="img/smileys/' . $id . '.gif" alt="' . $smiley . '" />';
$content = str_replace($smiley, $replace, $content); //Search, Replace, Content
}
return $content;
}?>
[/code]

Unfortunately I can't get it to make :p into an image because it only recognizes the capitalized P.. I've tried everything changing the replace thing do both (strtolower etc..)
But it just won't work...

I can't use PHP 5 functions btw.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.