Jump to content


Photo

How to count special characters function?


  • Please log in to reply
2 replies to this topic

#1 briant

briant
  • Members
  • PipPipPip
  • Advanced Member
  • 50 posts

Posted 27 October 2006 - 06:22 PM

I know the strlen function counts characters but not special characters. For example, I want this : êộờ to be only 3 characters, not 8 or whatever the strlen function gives.

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 27 October 2006 - 06:31 PM

Take a look at the multibyte string handling functions.

Ken

#3 briant

briant
  • Members
  • PipPipPip
  • Advanced Member
  • 50 posts

Posted 27 October 2006 - 06:48 PM

I get a weird error when I use mb_strlen

Fatal error: Call to undefined function: mb_strlen() in /home/mysite/public_html/mypage.php on line 223


Here is my example:

echo mb_strlen('êộờ', 'UTF-8');




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users