3v4l.org

run code in 300+ PHP versions simultaneously
<?php $expected = [ ['john', 'doe', 'john.doe@example.com', '0123456789'], ['jane', 'doe', 'jane.doe@example.com'], ]; $tmp = new SplTempFileObject(); foreach ($expected as $row) { $tmp->fputcsv($row); } $tmp->setFlags(0); $tmp->seek(23); var_dump($tmp->current()); $tmp->setFlags(SplFileObject::READ_CSV | SplFileObject::SKIP_EMPTY); $tmp->seek(23); var_dump($tmp->current());
based on VPSbG
Output for 5.6.0 - 5.6.4, 7.2.0 - 7.2.33, 7.3.0 - 7.3.28, 7.4.0 - 7.4.16, 8.0.0 - 8.0.3
bool(false) array(3) { [0]=> string(4) "jane" [1]=> string(3) "doe" [2]=> string(20) "jane.doe@example.com" }
Output for 5.6.5 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33
bool(false) bool(false)