Jump to content

Smiley parsing, case sensitive -> case insensitive


Mortier

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.