protected static function CountLines($text) { $c = 1; $pos = 0; while (($pos = strpos($text, "\n", $pos)) !== FALSE) { ++$c; ++$pos; } return $c; }