web_master Posted February 26, 2012 Share Posted February 26, 2012 I got another problem. It is a counting characters. When I reload text from database, I want to count how many characters are in text. The problem is that I use the timymce, and there is a tags </p> and formats <span> and other formats. How can I count characters without those format, just pure characters entire text? I need a php code. And some plus - text is in utf8 coding in database with utf8 bin. Quote Link to comment https://forums.phpfreaks.com/topic/257820-character-count/ Share on other sites More sharing options...
Pikachu2000 Posted February 26, 2012 Share Posted February 26, 2012 You could use strip_tags and strlen, perhaps. Quote Link to comment https://forums.phpfreaks.com/topic/257820-character-count/#findComment-1321427 Share on other sites More sharing options...
web_master Posted February 26, 2012 Author Share Posted February 26, 2012 You could use strip_tags and strlen, perhaps. I try this: strlen(strip_tags(html_entity_decode($request['text']))) but it still count tags when I wrote text in textarea the tinymce count correctly eg 28 characters, but after reload there is a 67 chars Quote Link to comment https://forums.phpfreaks.com/topic/257820-character-count/#findComment-1321428 Share on other sites More sharing options...
Pikachu2000 Posted February 26, 2012 Share Posted February 26, 2012 What does $request['text'] hold? Without knowing that, it's just a guess as to what's happening. Quote Link to comment https://forums.phpfreaks.com/topic/257820-character-count/#findComment-1321430 Share on other sites More sharing options...
web_master Posted February 27, 2012 Author Share Posted February 27, 2012 What does $request['text'] hold? Without knowing that, it's just a guess as to what's happening. $request['text'] is a text from database. Quote Link to comment https://forums.phpfreaks.com/topic/257820-character-count/#findComment-1321596 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.