I need to get an array with all the characters from the word, but the word has letters with special encoding like á when I execute the following 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] => line (1) "Ã" [5] => line (1) "¡"}
How can I do to get each character as follows?
array (5) {[0] => string (1) "w" [1] => string (1) "i" [2] => string (1) "t" [3] => string (1) "h" [4] => line (1) "á"}
php encoding tokenize character-encoding
leticia
source share