public function limtitLines($str, $lines = 1)
    {
        $line = "\n";
        for ($i=2; $i<=$lines; $i++) {
            $line .= "\n";
        }
        return preg_replace("/[\r\n]+/", "$line", $str);
    }
public function limtitLines($str, $lines = 1)
    {
        $line = "\n";
        for ($i=2; $i<=$lines; $i++) {
            $line .= "\n";
        }
        return preg_replace("/[\r\n]+/", "$line", $str);
    }
public function limtitLines ( $ str , $ lines = 1 ) { $ line = "\n" ; for ( $ i = 2 ; $ i <= $ lines ; $ i ++ ) { $ line .= "\n" ; } return preg_replace ( "/[\r\n]+/" , "$line" , $ str ) ; }
Limits the amount of line breaks in a string
@param  string  $str
@param  integer $lines Number of lines to be limited
@return string
Limits the amount of line breaks in a string