Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Preg_replace -> preg_replace_callback
ShutteR
post
Post #1





Grupa: Zarejestrowani
Postów: 33
Pomógł: 0
Dołączył: 21.10.2011

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


Cześć. Jako że 'e' w preg_replace() umiera dlatego potrzebuję przepisać:
Kod
$source = preg_replace("#\[leech\s*=\s*(\S.+?)\s*\](.*?)\[\/leech\]#ie", "\$this->build_url(array('html' => '\\1', 'show' => '\\2', 'leech' => '1'))", $source);

na fukncję preg_replace_callback() aby usunąć błąd z 'e'.
Mógłby ktoś pomóc? Bo się trochę pogubiłem z tym (IMG:style_emoticons/default/sad.gif)

Pozdrawiam

Ten post edytował ShutteR 15.02.2015, 18:21:15
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
ShutteR
post
Post #2





Grupa: Zarejestrowani
Postów: 33
Pomógł: 0
Dołączył: 21.10.2011

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


Np takie coś:
  1. $source = preg_replace_callback("#\[url\](\S.+?)\[/url\]#ie", function ($this) {
  2. return $this->build_url(array('html' => '\\1', 'show' => '\\1'));
  3. }, $source);

ale nie działa.
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: 8.10.2025 - 11:19