code: public function getContent($filePath, $startPosition, $endPosition)
      {
          if (!file_exists($filePath)) {
              return '';
          }
  
          // End position not saved yet
          if (!$endPosition) {
              return trim(file_get_contents($filePath, null, null, $startPosition));
          }
  
          // End position exists but is less then start position
          if ($endPosition <= $startPosition) {
              return '';
          }
  
          return trim(file_get_contents($filePath, null, null, $startPosition, $endPosition - $startPosition));
      }
docs: Returns content from specified file between specified range
  
  @param string $filePath
  @param int $startPosition
  @param int $endPosition
  @return string