Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]str_replace i emoticony
Maxie
post
Post #1





Grupa: Zarejestrowani
Postów: 82
Pomógł: 1
Dołączył: 19.10.2011

Ostrzeżenie: (0%)
-----


Chciałem zrobić system emoticon na php i coś mi nie działa. Oto funkcja przez którą przepuszczam tekst z emotkami:
  1. function emots($txt){
  2. $emots = array(
  3. '^^' => '<img src="emotes/^^.gif">',
  4. ':(' => '<img src="emotes/=(.gif">',
  5. ':)' => '<img src="emotes/=).gif">',
  6. '(IMG:style_emoticons/default/tongue.gif) ' => '<img src="emotes/=P.gif">',
  7. ':]' => '<img src="emotes/evil_smile.gif">',
  8. '(IMG:style_emoticons/default/snitch.gif) ' => '<img src="emotes/have_a_nive_day.gif">',
  9. 'o.o' => '<img src="emotes/O.o.gif">',
  10. '(IMG:style_emoticons/default/ohmy.gif) ' => '<img src="emotes/oh_noes.gif">',
  11. ':{' => '<img src="emotes/owie.gif">',
  12. ':/' => '<img src="emotes/serious.gif">',
  13. ':c' => '<img src="emotes/shame.gif">',
  14. 'T.T' => '<img src="emotes/T.T.gif">',
  15. 'WTF' => '<img src="emotes/WTF.gif">',
  16. '(IMG:style_emoticons/default/haha.gif) ' => '<img src="emotes/XD.gif">',
  17. );
  18. $txt = str_replace($txt, $emots, $txt);
  19. return $txt;
  20. }


I tego wynikiem powinien być tekst z obrazkami zamiast emotek. A jednak nie, bo wynikiem jest "Array". Co zrobić by wyniki to był tekst + obrazki zamiast emotek??
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 14:25