Jump to content

Show smileys using str_replace()

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
Guest_Jaan_*

Guest_Jaan_*
  • Guests

Posted Image


Edited by Jaan, 08 June 2010 - 09:43 AM.


#2
justin

justin

    Learning Programmer

  • Members
  • PipPipPip
  • 43 posts
// This will determine things what you want to replace

$replace = array(":)", ":D", ":(");


// This will determine your text replacement

$replace_to = array("<img src='smile.gif'>", "<img src='laugh.gif'>", "<img src='sad.gif'>");

$content = str_replace($replace, $replaceto, $text);

With the str_replace when you use the $replaceto variable, shouldn't it be $replace_to, like the variables name?

Myspace Resources


I am currently willing to do just about anything for $50 on paypal, anyone need odd jobs done?

#3
Guest_Jaan_*

Guest_Jaan_*
  • Guests
oops.. my bad oki i fixed it.. thanks

#4
justin

justin

    Learning Programmer

  • Members
  • PipPipPip
  • 43 posts
Just thought you might like to know :)

Myspace Resources


I am currently willing to do just about anything for $50 on paypal, anyone need odd jobs done?