Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]preg_replace i array_unique
tenloginjestzaje...
post
Post #1





Grupa: Zarejestrowani
Postów: 358
Pomógł: 1
Dołączył: 20.07.2014

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


Witam
Proszę o pomoc w rozwiązaniu tego problemu, chciałbym pobrać same linki występujące w tekście, wyświetlić bez powtórzeń.

  1. $preg_replace = array('@#(.+?)\b@');
  2. $search_replace = array('<a href="hashtag/$1">#$1</a>');
  3. $showcontent = preg_replace($preg_replace, $search_replace, $content);


Rozumiem, że wynik muszę wrzucić do tablicy, aby pozbyć się duplikatów? Pozdrawiam

Ten post edytował tenloginjestzajety 29.04.2017, 14:33:52
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
trueblue
post
Post #2





Grupa: Zarejestrowani
Postów: 6 807
Pomógł: 1828
Dołączył: 11.03.2014

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


http://php.net/manual/en/function.array-unique.php
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: 11.10.2025 - 06:27