how to get actual number of unicode character?
Posted: Mon Mar 01, 2010 3:08 am
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
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