I want to create a string using the unicode values of devnagari script, I want to use this in a php file.
Thanks in advance.
I want to create a string using the unicode values of devnagari script, I want to use this in a php file.
Thanks in advance.
You can't safely select a single utf-8 character with $letters[rand(0, $len-1)];
, since it's a multi-byte encoding: you just get a single byte. You should use mb_substr
instead.
$letter = mb_substr($letters, rand(0, $len-1), 1);