warum-span-ohne-utf8.php
Quell Code
<?php
header ('Content-Type: text/html; charset=utf-8');
$txtInput ='Dies könnte eine schöne Spaßübung sein.';
echo "Ausgabe 1<br>";
for ($i=0; $i<strlen($txtInput); $i++) {
$char = substr($txtInput,$i,1);
echo $char;
}
echo "<br><br>Ausgabe 2<br>";
for ($i=0; $i<strlen($txtInput); $i++) {
$char = substr($txtInput,$i,1);
echo '<span>'.$char.'</span>';
}
echo "<br><br>Ausgabe 3<br>";
for ($i=0; $i<strlen($txtInput); $i++) {
$char = mb_substr($txtInput,$i,1);
echo '<div>'.$char.'</div>';
}
?>
</body>
</html>