Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Seeks on a file pointer
<?php fseek(resource $stream, int $offset, int $whence = SEEK_SET): int
<?php assert($path !== '');
$handle = fopen($path, 'r');
assert($handle !== false);
$fseek = fseek($handle, $this->tailPositions[$path] ?? 0);
assert($fseek === 0);
$contents = '';
<?php $fp = fopen('php://temp', 'rb+');
assert(is_resource($fp));
fwrite($fp, $value);
fseek($fp, 0);
$value = $fp;
}
<?php $fp = fopen('php://temp', 'rb+');
assert(is_resource($fp));
fwrite($fp, $value);
fseek($fp, 0);
$value = $fp;
}
<?php public function ensuring_streams_are_rewound_when_writing(): void
{
$writeStream = stream_with_contents('contents');
fseek($writeStream, 4);
$this->filesystem->writeStream('path.txt', $writeStream);
$contents = $this->filesystem->read('path.txt');
<?php public function getOutput()
{
fseek($this->output->getStream(), 0);
$output = stream_get_contents($this->output->getStream());
<?php $input = new StringInput($run.' -vvv');
$input->setInteractive(false);
$result = $application->run($input, new StreamOutput($appOutput));
fseek($appOutput, 0);
if (!is_int($expectResult)) {