user3535945
user3535945

Reputation: 241

Need help on tamil character counting using PHP

I have the following code

<?php
$str = "இந்தியர்களின்";
echo strlen($str);
echo "<br>".mb_strlen($str, 'UTF-8');?>

Which outputs
39
13

But as you seen in code only 8 characters are there (I accept 13 is the correct one by logic). But I need the character count only.

Can anyone provide me the solution for this

Upvotes: 2

Views: 126

Answers (1)

user3535945
user3535945

Reputation: 241

I found the solution

<?php
$str = "இந்தியர்களின்";
   echo grapheme_strlen($str);
?>

This works as expected

Thanks

Upvotes: 1

Related Questions