I have bellow string which has content and anchor tag:
$string = 'I am a lot of text with <a href="#">links in it</a>';
and I want to remove anchor tag with its text(links in it)
I have tried with strip_tags
but it remains anchor text in the string, after that, I have tried with preg_replace
with this example:
$string = preg_replace('/<a[^>]+>([^<]+)<\/a>/i', '\1', $string);
but getting same result as strip_tags
.
I just want "I am a lot of text with" after removing anchor tag.
Any idea?