web_master Posted January 5, 2009 Share Posted January 5, 2009 Hi, I got a text in dBase for example <b>12345abc</b> (this is sum 27 chars) this mean <b>12345abc</b> (this is 8 chars and <b></b>) How can I count from database to divide <b> and </b> (or other) from counting I know for $CharS = $request['text']; echo strlen($CharS); but this count all of chars. thnx Quote Link to comment https://forums.phpfreaks.com/topic/139554-solved-count-characters-minus-some-characters/ Share on other sites More sharing options...
dennismonsewicz Posted January 5, 2009 Share Posted January 5, 2009 you could use this http://us.php.net/strip_tags Quote Link to comment https://forums.phpfreaks.com/topic/139554-solved-count-characters-minus-some-characters/#findComment-730004 Share on other sites More sharing options...
Adam Posted January 5, 2009 Share Posted January 5, 2009 He'd need to convert them to HTML tags first, try: echo strlen(strip_tags(html_entity_decode($CharS))); A Quote Link to comment https://forums.phpfreaks.com/topic/139554-solved-count-characters-minus-some-characters/#findComment-730007 Share on other sites More sharing options...
sloth456 Posted January 5, 2009 Share Posted January 5, 2009 maybe use str_replace to replace both sets of tags with blanks. Quote Link to comment https://forums.phpfreaks.com/topic/139554-solved-count-characters-minus-some-characters/#findComment-730010 Share on other sites More sharing options...
web_master Posted January 5, 2009 Author Share Posted January 5, 2009 He'd need to convert them to HTML tags first, try: echo strlen(strip_tags(html_entity_decode($CharS))); A THIS WORK! Quote Link to comment https://forums.phpfreaks.com/topic/139554-solved-count-characters-minus-some-characters/#findComment-730011 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.