Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> preg replace i zamiana na funkcje
1010
post
Post #1





Grupa: Zarejestrowani
Postów: 749
Pomógł: 37
Dołączył: 3.10.2006

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


Witam,
mam taki kod:
  1. <?
  2. $newtext = eregi_replace("{YOUTUBE}(.*){/YOUTUBE}", "1", $newtext);
  3. ?>

zamienia ona coś takiego
Kod
hfud ishu ihfds hfuis huif {YOUTUBE}tutaj link{/YOUTUBE} fhus hfui h

na
Kod
hfud ishu ihfds hfuis huif tutaj link fhus hfui h



Natomiast gdy chcę zrobić takie cos:
  1. <?
  2. $newtext = eregi_replace("{YOUTUBE}(.*){/YOUTUBE}", youtube("1"), $newtext);
  3. ?>

moim celem jest aby w miejsce {YOUTUBE}tutaj link{/YOUTUBE} funkcja zrobiła z linku object. Jednak gdy w funkcji wyświetle parametr który przekazuje to wyświetla \1. Dlaczego nie przekazuje linku?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
1010
post
Post #2





Grupa: Zarejestrowani
Postów: 749
Pomógł: 37
Dołączył: 3.10.2006

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


Dzięki bardzo (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) Działa (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

Musze przyznać że wyrażenia regularne nie są moja mocną stroną (IMG:http://forum.php.pl/style_emoticons/default/smile.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: 4.10.2025 - 02:12