Unverified.
function getline($file, $linenum, $linelen = 8192) {
$handle = fopen($file, "r");
if ($handle) {
while (!feof($handle)) {
$linenum -= 1;
$buffer = fgets($handle, $linelen);
if (!$linenum) return $buffer;
}
fclose($handle);
}
return -1;
}
source
share