Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] emotikony a str_replace
bahh
post
Post #1





Grupa: Zarejestrowani
Postów: 261
Pomógł: 2
Dołączył: 13.05.2012

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


Mam funkcję do emotikon:

  1. function emoticons($string)
  2. {
  3. str_replace(':)','<img src="images/emoticons/smile.png" alt="" />',$string);
  4. str_replace(':(','<img src="images/emoticons/angry.png" alt="" />',$string);
  5. str_replace(';)','<img src="images/emoticons/wink.png" alt="" />',$string);
  6. str_replace(';(','<img src="images/emoticons/cry.png" alt="" />',$string);
  7. return $string;
  8. }


jednakże jak występuje string typu bla bla bla (IMG:style_emoticons/default/smile.gif) to nie podmienia na <img src="...">

co jest nie tak?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
modern-web
post
Post #2





Grupa: Zarejestrowani
Postów: 763
Pomógł: 117
Dołączył: 15.03.2010
Skąd: void

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


Wtrącę się z tematem wydajności str_replace, przy dużej liczbie takich operacji Twój skrypt może znacznie spowolnić, także uważaj w jaki sposób tego używasz.

Ten post edytował modern-web 3.12.2014, 19:21:49
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: 3.10.2025 - 07:39