Which function in php validate if the string is html?
My target to take input from user and check if input html and not just string.
Example for not html string:
sdkjshdk<div>jd</h3>ivdfadfsdf or sdkjshdkivdfadfsdf
Example for html string:
<div>sdfsdfsdf<label>dghdhdgh</label> fdsgfgdfgfd</div>
Thanks
Maybe you need to check if the string is well formed.
I would use a function like this
Just a warning: html permits unbalanced string like the following one. It is not an xml valid chunk but it is a legal html chunk
Disclaimer I’ve modified the code (without testing it). in order to detect well formed html inside the string.
A last though
Maybe you should use strip_tags to control user input (As I’ve seen in your comments)