3v4l.org

run code in 300+ PHP versions simultaneously
<?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; }
Output for 8.4.5 - 8.4.7
Deprecated: SplFileObject::fputcsv(): the $escape parameter must be provided, as its default value will change, either explicitly or via SplFileObject::setCsvControl() in /in/vLlb0 on line 9 6 6 Deprecated: SplFileObject::fputcsv(): the $escape parameter must be provided, as its default value will change, either explicitly or via SplFileObject::setCsvControl() in /in/vLlb0 on line 9 6 6
Output for 8.4.1 - 8.4.4
Deprecated: SplFileObject::fputcsv(): the $escape parameter must be provided, as its default value will change, either explicitly or via SplFileObject::setCsvControl() in /in/vLlb0 on line 9 6 6 Deprecated: SplFileObject::fputcsv(): the $escape parameter must be provided, as its default value will change, either explicitly or via SplFileObject::setCsvControl() in /in/vLlb0 on line 9 Fatal error: Uncaught AssertionError: assert(6 === $fileW->getSize()) in /in/vLlb0:10 Stack trace: #0 /in/vLlb0(10): assert(false, 'assert(6 === $f...') #1 {main} thrown in /in/vLlb0 on line 10
Process exited with code 255.
Output for 8.3.18 - 8.3.20
6 6 6 6
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.32, 8.2.0 - 8.2.28, 8.3.0 - 8.3.17
6 6 Fatal error: Uncaught AssertionError: assert(6 === $fileW->getSize()) in /in/vLlb0:10 Stack trace: #0 /in/vLlb0(10): assert(false, 'assert(6 === $f...') #1 {main} thrown in /in/vLlb0 on line 10
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.27, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
6 6 Warning: assert(): assert(6 === $fileW->getSize()) failed in /in/vLlb0 on line 10 0 Warning: assert(): assert(6 === $fileR->getSize()) failed in /in/vLlb0 on line 14 0
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
6 6 Warning: assert(): Assertion failed in /in/vLlb0 on line 10 0 Warning: assert(): Assertion failed in /in/vLlb0 on line 14 0

preferences:
152.08 ms | 414 KiB | 5 Q