'; $expectedEnd = ''; $startingElement = fread($archiveHandle, strlen($expectedStart)); if ($startingElement !== $expectedStart) { throw new Exception("Invalid starting element. Was expecting {$expectedStart} but got {$startingElement}"); } $headerString = stream_get_line($archiveHandle, self::MAX_FILED_LEN, $expectedEnd); if ($headerString === false) { throw new Exception('Error reading line.'); } return $headerString; } }