How to remove a link from content in php?
While strip_tags()
is capable of basic string sanitization, it's not fool-proof. If the data you need to filter is coming in from a user, and especially if it will be displayed back to other users, you might want to look into a more comprehensive HTML sanitizer, like HTML Purifier. These types of libraries can save you from a lot of headache up the road.
strip_tags()
and various regex methods can't and won't stop a user who really wants to inject something.