1

I use this javascript code

<input id="text" value="漢字">
var text_val = document.getElementById("text").value.length;  // result will be 2 //

for as same as php code

$text_val = mb_strlen('漢字', 'utf-8'); // result will be 2 //

And then i want to know what javascript as same as this php code ?

$text_val = strlen("漢字");  // result will be 6 //

0 Answers0