Advertisement
mendigo

Untitled

Aug 16th, 2011
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.35 KB | None | 0 0
  1. function QuebraDeLinha($string, $max = 50, $quebra = "\n"){
  2.     if( strlen($string) > $max ){
  3.        $strings = explode(' ',$string);
  4.        foreach($strings as $a => $b ){
  5.             if( strlen( $tmp.' '.$b ) > $max ){
  6.                 $str_tmp .= $tmp.$quebra;
  7.                 $tmp = '';
  8.             }else{
  9.             $tmp .= ' '.$b;
  10.             }
  11.        }
  12.     }else{
  13.         $str_tmp = $string;
  14.     }
  15.     return $str_tmp;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement