<?php
function str_split_unicode($str, $l = 0) {
return preg_split('/(.{'.$l.'})/us', $str, -1, PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE);
}
$array = str_split_unicode("¿Habla usted español?");
print_r($array);
echo "<hr>";
while (list($i, $v) = each($array)) {
echo "$i , $v<br>";
}
echo "<hr>";
foreach ($array as $i => $v) {
echo "$i , $v<br>";
}
echo "<hr>";
$array = array("A" => "papá", "B" => "tendré", "C" => "cereza", "Ch" => "leche", "Ñ" => "niño", "R" => "rojo");
while (list($i, $v) = each($array)) {
echo "$i , $v<br>";
}
?>