{% else-1 %}
wordwrap для многобайтовых кодировок

                        
<?php 
/**
* wordwrap для многобайтовых кодировок
* хостинг: http://vipcou.ru
* 20.02.10
*/

function mb_wordwrap($str, $width=75, $break="\n", $cut=false, $charset="null") {
if ($charset == "null") $charset = mb_internal_encoding();
$pieces = split($break, $str);
$result = array();
foreach ($pieces as $piece) {
$current = $piece;
while ($cut && mb_strlen($current) >$width) {
$result[] = mb_substr($current, 0, $width, $charset);
$current = mb_substr($current, $width, 2048, $charset);
}
$result[] = $current;
}
return(implode($break, $result));
}

echo mb_wordwrap($mb_string, 16, "<br/>", true, "utf-8");

?>
0 47 0
Без комментариев...