hi guys,
obviously there are many ways to remove bits and bobs from a string... currently what i am doing is using str_replace like so:
where $tags is an array full of different bits that i want removed, but this is getting quite messy...
if i give an example of some lines (yes they are html tags but just look at them as strings) and show you how i want them to end up, maybe someone could tell me a much easier way to do it than the above:
<img src="image.jpg" />
image.jpg
<image src="image.jpg" class="*could be anything*" title="*could be anything* />
image.jpg
<span class="*could be anything*">Don't look back in anger</span>
Don't look back in anger
<p>Howdy</p>
Howdy
you get the idea, i'm stripping away all the unessesary stuff each time and at the moment the array is getting out of control with all different versions of what could be either side of the bit i need...
any ideas?
obviously there are many ways to remove bits and bobs from a string... currently what i am doing is using str_replace like so:
PHP:
str_replace($tags, '', $line);
where $tags is an array full of different bits that i want removed, but this is getting quite messy...
if i give an example of some lines (yes they are html tags but just look at them as strings) and show you how i want them to end up, maybe someone could tell me a much easier way to do it than the above:
<img src="image.jpg" />
image.jpg
<image src="image.jpg" class="*could be anything*" title="*could be anything* />
image.jpg
<span class="*could be anything*">Don't look back in anger</span>
Don't look back in anger
<p>Howdy</p>
Howdy
you get the idea, i'm stripping away all the unessesary stuff each time and at the moment the array is getting out of control with all different versions of what could be either side of the bit i need...
any ideas?