Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Problem z Polskimi znakami w str_replace, function friendly_seo_string
lukaszk
post
Post #1





Grupa: Zarejestrowani
Postów: 159
Pomógł: 0
Dołączył: 21.12.2010

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


Witam, mam problem z funkcją i nie wiem jak to przeskoczyć.
Poniższa funkcja zamienia znaki na inne mam problem z ą ę ś ć ź itd chcę aby zamieniała na a e .....
a obecnie niestety usuwa polskie znaki i zwraca wynik bez ładu i składu proszę o pomoc co muszę dopisać/zmienić w kodzie?
  1. <?php
  2. function friendly_seo_string($string, $separator = '-')
  3. {
  4. $string = trim($string);
  5.  
  6. $string = strtolower($string); // convert to lowercase text
  7.  
  8. $string = trim(ereg_replace("[^ A-Za-z0-9_]", " ", $string));
  9.  
  10.  
  11.  
  12. $string = ereg_replace("[ tnr]+", "-", $string);
  13.  
  14. $string = str_replace(" ", $separator, $string);
  15.  
  16. $string = ereg_replace("[ -]+", "-", $string);
  17.  
  18. return $string;
  19. }
  20. ?>


Ten post edytował lukaszk 5.04.2011, 15:00:11
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
JoShiMa
post
Post #2





Grupa: Zarejestrowani
Postów: 1 374
Pomógł: 149
Dołączył: 1.03.2006

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


patrz punkt 3 (IMG:style_emoticons/default/smile.gif)


a potem kliknij co trzeba (IMG:style_emoticons/default/wink.gif)
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 - 05:51