Hi,
In my previous thread, I asked for a way to convert all instances of things like:
<a href="http://www.boo.com/dir/boo.php">link text</a>
to:
http://www.boo.com/dir/boo.php
the solution I came up with was:
function htmltotext($html){
$text=stri_replace("<br>","\n",$html);
$text=str_replace(" ยป","",$text);
$text=eregi_replace ("<a[^>]+href *=\" *([^ ]+)[^>]*\">([^ ]+)</a>", "\\1", $text);
return strip_tags($text);
}
Unfortunately, it only converts the first instance of a link correctly, all else are returned wrongly. I thought maybe preg_replace would work better, but preg_replace doesn't work at all with that regexp.
Many thanks in advance,
ucbones
NB. stri_replace is a function I've defined in my functions file, and does not exist as a built in function, see the manual for various ideas of how to define it!