strip_tags
<?php $input = "This <a href='http://www.java2s.com/'>example</a>!"; echo strip_tags($input, "<a>"); ?>