Re: Get text between A and B?

From: Jedi121 (jedi121news_at_free.fr.Removethis)
Date: 11/17/03


Date: Mon, 17 Nov 2003 20:14:41 +0100


"Philipp Lenssen" a écrit le 17/11/2003 :
> Then I could say:
>
> $s = getTextBetween("<h2>foo</h2><p>Hello World</p><h2>bar</h2>",
> "<h2>", "</h2>", 1);
> echo $s; // ... would be "bar"
>
> ------------
>
> Any help greatly appreciated!

I would use a combination of explode :
explode( "<h2>", "<h2>foo</h2><p>Hello World</p><h2>bar</h2>")
and for each element explode( "</h2>", element)