Jump to content

Little Niggle with Function ?


PHPFAN10

Recommended Posts

Hi,

 

I have a simple smiley function below. Everything works great. Problem i am having is for (big grin) i enter


and it would show a big grin smiley like it should but if it enter


it will show it as it is in text. I want to make my function so that whether it would be a capital letter or not aslong as the letter matches it would still show the (big grin) smiley, at the moment it has to exactly match. The samething applies to all my smileys in function apart from


 

Could someone edit it for me please to correct where i am going wrong?

 

<?php
# Smilies Function
function smileycode($smileycode) {
$input = array(
    '',
    '',
    '',
    '',
    ''
);

$output = array(
    '<img src="/images/smileys/001_smile.gif" alt="" />',
    '<img src="/images/smileys/sad.gif" alt="" />',
    '<img src="/images/smileys/biggrin.gif" alt="(Big Grin)" />',
    '<img src="/images/smileys/ohmy.gif" alt="(OMG)" />',
    '<img src="/images/smileys/001_tongue.gif" alt="(Poke Tongue)" />'
);

$smileyrtrn = str_replace($input, $output, $smileycode);

return $smileyrtrn;
}
?>

 

Thanks

PHPLOVEr

Link to comment
https://forums.phpfreaks.com/topic/225387-little-niggle-with-function/
Share on other sites

Archived

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

×
×
  • 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.