Reputation: 93
Is it possible to use preg_replace and strip_tags together on the same string?
I'm trying to remove HTML tags and all non_alpha_numeric characters from a string using the following :
<?=strip_tags (preg_replace('/[^\da-z]/i', ' ', $line['features']))?>,
This is currently removing the non_alpha characters but leaving the tags minus the brackets/parenthesis.
Anybody help?
Upvotes: 1
Views: 280
Reputation: 800
your preg_replace is removing the "<" ">" values so strip_tags doesn't recognise them as tags,
if you reverse the functions
<?=preg_replace('/[^\da-z]/i', ' ', strip_tags($line['features']));?>
it should work
Upvotes: 2