- assert: documentation ( source)
- sys_get_temp_dir: documentation ( source)
- tempnam: documentation ( source)
- range: documentation ( source)
<?php
$paths = [
sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'bishop',
tempnam(sys_get_temp_dir(), 'bishop'),
];
foreach ($paths as $path) {
$fileW = new \SplFileObject($path, 'w');
$fileW->fputcsv(range(0,2));
assert(6 === $fileW->getSize());
echo $fileW->getSize() . PHP_EOL;
$fileR = new \SplFileObject($path, 'r');
assert(6 === $fileR->getSize());
echo $fileR->getSize() . PHP_EOL;
}