한 번 연구해봐.....
내가 만든 PHP 게시판에서 사용중인거다....
$title_length_limit = 60 - $thread_length;
$title_length = strlen($ctitle);
if ($title_length > $title_length_limit)
{
$han_count=0;
for ($j = 0; $j < $title_length_limit ; $j++)
{
$han = ord(substr($ctitle,$j,1));
if(($han & 0x80)==128)
{
$han_count++;
}
}
$mod=$han_count % 2;
if($mod == 0)
{
$ctitle = substr($ctitle , 0, $title_length_limit);
$ctitle = $ctitle . "...";
}
else
{
$title_length_limit = $title_length_limit + 1;
$ctitle = substr($ctitle,0,$title_length_limit);
$ctitle = $ctitle . "...";
}
}