Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] preg_match, jak wyciagnac z pomiedzy tagu, wartosci
AndyPSV
post
Post #1





Grupa: Zarejestrowani
Postów: 393
Pomógł: 5
Dołączył: 6.02.2003
Skąd: The.Luciferian.Doctrine.p
df

Ostrzeżenie: (30%)
XX---


PRZYKLAD: <td class="xl41">Bole
slawiec</td> (chodzi jeszcze o usuniecie znaku \r\n)
chce wyciagnac: "BOLESLAWIEC"

Ten post edytował AndyPSV 21.09.2010, 00:49:56
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
lukaskolista
post
Post #2





Grupa: Zarejestrowani
Postów: 872
Pomógł: 94
Dołączył: 31.03.2010

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


jesli nie musi byc to koniecznie zrobione przez preg_match polecam
  1. <?php
  2.  
  3. $string = '<td class="xl41">Boleslawiec</td>';
  4. $start = strpos($string, '<td class="xl41">');
  5. $length = strlen('<td class="xl41">');
  6. $start += $length;
  7. $end = strpos($string, '</td>');
  8. $boleslawiec = substr($string, $start, $end);
  9.  
  10. ?>
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: 10.10.2025 - 15:45