I am trying to use some specific symbols in a string. I need to loop through each character of the string and identify the symbols. However, certain symbols are getting converted to THREE CHARACTERS. Need help on how to retain the symbol.
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 IS THE WORKING CODE. Thanks to 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;
}