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. 'tongue.gif' => '<img src="emotes/=P.gif">',
  7. ':]' => '<img src="emotes/evil_smile.gif">',
  8. 'snitch.gif' => '<img src="emotes/have_a_nive_day.gif">',
  9. 'o.o' => '<img src="emotes/O.o.gif">',
  10. '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. '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
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 11:54