I am trying to use some specific characters in a string. I need to go through each character of a string and identify the characters. However, some characters are converted to THREE CHARACTERS. Need help on how to save the character.
echo $instring = ("& ∨ = ⊢");
echo "\nLength of string: ".strlen($instring);
for ($i = 0; $i < strlen($instring) ; $i++){
$temp_str = substr($instring, $i,1);
echo "\nChar: $i: $temp_str";
$instring_arr[$i] = $temp_str;
}
HERE WORKING CODE. Thanks h2oooooo:
echo $instring = ("& ∨ = ⊢");
echo "\nLength of string: ".mb_strlen($instring, "UTF-8");
for ($i = 0; $i < mb_strlen($instring, "UTF-8") ; $i++){
$temp_str = mb_substr($instring, $i,1,"UTF-8");
echo "\nChar: $i: $temp_str";
$instring_arr[$i] = $temp_str;
}
source
share