How to eliminate html tags and also some special characters ?

0 Chandan A V · September 20, 2015
Guys can anyone tell me how to eliminate html tags and special characters other than strip_tags() 

Post a Reply


Oldest  Newest  Rating
0 Albo Coder · September 20, 2015
you can make a new string out of the old one and go through each character. If the character is '<' set a boolean to false so it wont add it to the new string and then when '>' is found set the boolean to true and the others after '>' can be added. 

It is not the best way because in a <p></p> tag you can have text like "soccer < basketball" and then the program would start ignoring the part "< basketball" but you can come up with something if you encounter this trouble.

For example another string  array of ignored data and indexes for each ignore and take that array and recover the stuff... 

If this hit your imagination and u came up with a better solution please write back.
  • 1



Server-side, HTML embedded scripting language used to create dynamic Web pages.