ho risolto con questa funzione


Codice PHP:
<?php

function textWrap($text$size$separator="
) {

   
$new_text '';
   
$text_1 explode('>',$text);
   
$sizeof sizeof($text_1);
   
$remain $size;
  
   for (
$i=0$i<$sizeof; ++$i) {
      
       
$text_2 explode('<',$text_1[$i]);
      
       if (!empty(
$text_2[0])){
           
$perl '/([^\\n\\r .]{'$remain .',})/i';
           
$possibly_splittedpreg_replace$perl'$1'.$separator$text_2[0] );
          
           
$splitted explode($separator,$possibly_splitted);
           
$remain -= strlen($splitted[0]);
           if(
$remain<=0$remain $size;
          
           
$new_text .= $possibly_splitted;
       }
  
       if (!empty(
$text_2[1])) $new_text .= '<' $text_2[1] . '>';
   }
   return 
$new_text;
}
?>
saluti!