$htm = "<a href='http://www.php100.net'>test1</a><br />" . "<a href='http://www.php100.net'>test2</a><br />" . "<a href='http://www.php100.net'>test3</a><br />" . "<a href='http://www.php100.net'>test4</a><br />" . "<a href='http://www.php100.net'>test5</a><br />"; echo $htm . "<br />"; echo stripthetag($htm); function stripthetag($link) { return (preg_replace('@<[/!]*?[^<>]*?>@si', ' ', $link)); }