I need to get an array with all the characters from a word, but the word has letters with special encoding like á, when I execute the follow code:
$word = 'withá';
$word_arr = array();
for ($i=0;$i<strlen($word);$i++) {
$word_arr[] = $word[$i];
}
or
$word_arr = str_split($word);
I get:
array(6) { [0]=> string(1) "w" [1]=> string(1) "i" [2]=> string(1) "t" [3]=> string(1) "h" [4]=> string(1) "Ã" [5]=> string(1) "¡" }
How can I do to obtain each character as follow?
array(5) { [0]=> string(1) "w" [1]=> string(1) "i" [2]=> string(1) "t" [3]=> string(1) "h" [4]=> string(1) "á" }