Removing HTML tags by using strip_tag function
This function also allows one optional string where we can keep the tags which are not to be removed. Say we don't want the hyper links to be removed. So we will allow the linking tag <a href to be kept as it is. Here is the syntax for this.
In the above code $string_str is the input string.
Using strip_tags function we can collect content from different pages of a directory. Now let us try to collect the content of a sample page test.php. You can read the tutorial on how to collect content of a page here.
Here is the code to collect the content of the page and then we will apply strip_tags to remove all tags and display only the text content without any HML formatting.
Subscribe to our YouTube Channel here
This article is written by plus2net.com team. https://www.plus2net.com