I have an HTML form that sends 索索索 using post to my PHP file.
I tried strlen on it, but it gives me 24 instead of 3 (?!)…and this then breaks my for loop:
$in=$_POST['inn'];
$length=strlen($in)
for ($i=0; $i<$length; $i++) {
$cleanchar=$in[$i];
}
I want cleanchar as an individual character, like if only one character had been sent down with the POST.
How can I separate each character using PHP?
Try using
mb_strlenfor multi-byte characters operations:From documentation:
http://php.net/manual/en/function.mb-strlen.php