We are building a full in memory string instead of streaming, so let
PHP perform the heavy lifting of building the string in C instead of
doing it manually in 512 Byte chunks.
$this->file->seek($header['offset']);
// read data
- $content = '';
- $n = floor($header['size'] / 512);
- for ($i = 0; $i < $n; $i++) {
- $content .= $this->file->read(512);
- }
- if (($header['size'] % 512) != 0) {
- $buffer = $this->file->read(512);
- $content .= substr($buffer, 0, $header['size'] % 512);
- }
+ $content = $this->file->read($header['size']);
return $content;
}