I have a php web sites in wich I can manages articles. On the Add a new article form, there is a rich-text-box (allows HTML input) that I’d like to limit the character input count. I check on the server side so using the strlen()Docs method.
The problem is strlen seems to give a number that is way too big. I tried to use html_entity_decode()Docs to get the html tags out of the string but still the string length resulting seems to be wrong.
html_entity_decodeonly decodes HTML entities, it doesn’t ignore HTML tags. Try:Or the multi-byte equivalent: