Jump to content

how to get actual number of unicode character?


markthien

Recommended Posts

Hi guys,

 

I got a textarea let user enter their remark and I need to get the length of user entered remark.

Hence, I use strlen but it's no right when user enter both chinese and alphabet together like:

 

$tmp = 'Hello dear'; // string from textarea

$len = strlen($tmp); // this is correct where it return 10

 

$tmp = 'Hello dear 双皮奶'; // string from textarea

$len = strlen($tmp); // this is not really correct where it return 19

 

I need it to return length of 13 for the 2nd one. Hwo to do that? thanks!

 

Cheers,

Mark Thien

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.