[PHP]指定文字数で改行
function mb_ret( $str ,$width ){ $split = preg_split( '/(?<!^)(?!$)/u', $str ); $line = ''; $ret = ''; while( count($split) > 0 ){ $line .= array_shift($split); if( mb_strwidth($line) > $width or count($split) < 1 ){ $ret .= $line."\n"; $line = ''; }; }; return $ret; }