@@ -9,16 +9,23 @@ |
||
| 9 | 9 | { |
| 10 | 10 | // Open file |
| 11 | 11 | $f = @fopen($filepath, "rb"); |
| 12 | - if ($f === false) return false; |
|
| 12 | + if ($f === false) { |
|
| 13 | + return false; |
|
| 14 | + } |
|
| 13 | 15 | // Sets buffer size, according to the number of lines to retrieve. |
| 14 | 16 | // This gives a performance boost when reading a few lines from the file. |
| 15 | - if (!$adaptive) $buffer = 4096; |
|
| 16 | - else $buffer = ($lines < 2 ? 64 : ($lines < 10 ? 512 : 4096)); |
|
| 17 | + if (!$adaptive) { |
|
| 18 | + $buffer = 4096; |
|
| 19 | + } else { |
|
| 20 | + $buffer = ($lines < 2 ? 64 : ($lines < 10 ? 512 : 4096)); |
|
| 21 | + } |
|
| 17 | 22 | // Jump to last character |
| 18 | 23 | fseek($f, -1, SEEK_END); |
| 19 | 24 | // Read it and adjust line number if necessary |
| 20 | 25 | // (Otherwise the result would be wrong if file doesn't end with a blank line) |
| 21 | - if (fread($f, 1) != "\n") $lines -= 1; |
|
| 26 | + if (fread($f, 1) != "\n") { |
|
| 27 | + $lines -= 1; |
|
| 28 | + } |
|
| 22 | 29 | |
| 23 | 30 | // Start reading |
| 24 | 31 | $output = ''; |