3v4l.org

run code in 500+ PHP versions simultaneously
<?php function test($obj) { $obj->fputcsv([]); } $objects = [ new SplFileObject(tempnam(sys_get_temp_dir(), 'tmp')), (new ReflectionClass( "SplFileObject" ))->newInstanceWithoutConstructor(), ]; foreach ($objects as $obj) { test($obj); }
Output for 8.1.0 - 8.1.34, 8.2.0 - 8.2.34, 8.3.0 - 8.3.1, 8.3.3 - 8.3.35
Notice: SplFileObject::fputcsv(): Write of 1 bytes failed with errno=9 Bad file descriptor in /in/XMvIQ on line 4
Process exited with code 139.
Output for 8.3.2
Fatal error: Uncaught RuntimeException: SplFileObject::__construct(/tmp/tmpPC3zQL): Failed to open stream: Permission denied in /in/XMvIQ:8 Stack trace: #0 /in/XMvIQ(8): SplFileObject->__construct('/tmp/tmpPC3zQL') #1 {main} thrown in /in/XMvIQ on line 8
Process exited with code 255.
Output for 8.4.1 - 8.4.23, 8.5.0 - 8.5.8
Deprecated: SplFileObject::fputcsv(): the $escape parameter must be provided, as its default value will change, either explicitly or via SplFileObject::setCsvControl() in /in/XMvIQ on line 4 Notice: SplFileObject::fputcsv(): Write of 1 bytes failed with errno=9 Bad file descriptor in /in/XMvIQ on line 4
Process exited with code 139.
Output for 8.4.24 - 8.4.26, 8.5.9 - 8.5.11
Deprecated: SplFileObject::fputcsv(): the $escape parameter must be provided, as its default value will change, either explicitly or via SplFileObject::setCsvControl() in /in/XMvIQ on line 4 Notice: SplFileObject::fputcsv(): Write of 1 bytes failed with errno=9 Bad file descriptor in /in/XMvIQ on line 4 Fatal error: Uncaught Error: Object not initialized in /in/XMvIQ:4 Stack trace: #0 /in/XMvIQ(4): SplFileObject->fputcsv(Array) #1 /in/XMvIQ(13): test(Object(SplFileObject)) #2 {main} thrown in /in/XMvIQ on line 4
Process exited with code 255.

preferences:
34.57 ms | 1174 KiB | 18 Q