جرب الداله دية
كود PHP:
function word_wrap($text,$end=false,$num=false,$do=false,$start=0) {
$text=preg_replace('/(\s+)/','|&',$text);
$i=0;
$exp=explode("|&",$text);
$end=($end)?$end:count($exp);
$exp=array_slice($exp,$start,$end);
foreach($exp as $texts) {
$i++;
$r_text.=$texts." ";
if($num!=false and $i==$num){
$r_text.=$do;
$i=0;
}
}
return $r_text ;
}