PHP - Delete/Remove data from between 2 points

Associate
Joined
18 Oct 2002
Posts
100
I'm trying to remove the data from between 2 points

remove everything from inbetween the tags
e.g.

<Data></Data>

Code:
<Data><spec><Group>books</Group><producer>Whatever</producer><item>143118</item><Log>14:25:00 15/12/99</Log><Tones>Some ringtones</Tones></spec></Data>

Not sure which php function will deal with this ?

Thanks in advance
 
Time for some good old regular expressions. :)

Take a look at the function preg_replace.

Heres a little example, which makes text inside bold BB tags, bold. Simply adapt to suit.
Code:
$Text = preg_replace("|\[b\](.*?)\[/b\]|s", "<strong>\$1</strong>", $Text);
 
sloth said:
Time for some good old regular expressions. :)

Take a look at the function preg_replace.

Heres a little example, which makes text inside bold BB tags, bold. Simply adapt to suit.
Code:
$Text = preg_replace("|\[b\](.*?)\[/b\]|s", "<strong>\$1</strong>", $Text);

Many thanks, works great, I'm going to have to do a bit more reading on that function :)
 
Back
Top Bottom