3v4l.org

run code in 300+ PHP versions simultaneously
<?php $temp = tempnam(sys_get_temp_dir(), 'csv_bug'); file_put_contents($temp, <<<'CSV' first,second foo,bar "foo baz",bar baz,bar CSV ); $expected = array( array('first', 'second'), array('foo', 'bar'), array("foo\nbaz", 'bar'), array('baz', 'bar'), ); $cases = array( 'drop newline' => \SplFileObject::DROP_NEW_LINE, 'skip empty' => \SplFileObject::SKIP_EMPTY, 'skip empty + read ahead' => \SplFileObject::SKIP_EMPTY | \SplFileObject::READ_AHEAD, 'drop newline + read ahead' => \SplFileObject::DROP_NEW_LINE | \SplFileObject::READ_AHEAD, 'drop newline + skip empty' => \SplFileObject::DROP_NEW_LINE | \SplFileObject::SKIP_EMPTY, 'all' => \SplFileObject::DROP_NEW_LINE | \SplFileObject::SKIP_EMPTY | \SplFileObject::READ_AHEAD, ); foreach ($cases as $name => $flags) { $file = new SplFileObject($temp); $file->setFlags($flags | \SplFileObject::READ_CSV); echo $name, "\n"; var_dump(iterator_to_array($file, false)); } var_dump('expected', $expected);

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.70.0160.00616.50
8.3.60.0100.00618.55
8.3.50.0130.00722.02
8.3.40.0100.01018.70
8.3.30.0160.00018.61
8.3.20.0000.00822.07
8.3.10.0040.00420.15
8.3.00.0030.00623.83
8.2.180.0130.00616.36
8.2.170.0130.00622.96
8.2.160.0090.00622.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0030.00520.62
8.2.110.0030.00721.04
8.2.100.0060.00617.73
8.2.90.0030.00618.97
8.2.80.0030.00617.97
8.2.70.0060.00317.63
8.2.60.0040.00417.80
8.2.50.0080.00018.07
8.2.40.0040.00418.03
8.2.30.0040.00418.23
8.2.20.0050.00318.02
8.2.10.0000.00919.43
8.2.00.0040.00419.49
8.1.280.0130.00725.92
8.1.270.0030.00623.78
8.1.260.0090.00026.35
8.1.250.0080.00028.09
8.1.240.0200.00319.18
8.1.230.0090.00317.77
8.1.220.0030.00617.78
8.1.210.0040.00418.77
8.1.200.0000.00917.35
8.1.190.0090.00017.23
8.1.180.0030.00518.10
8.1.170.0110.00018.78
8.1.160.0060.00318.99
8.1.150.0030.00618.99
8.1.140.0050.00318.88
8.1.130.0030.00620.07
8.1.120.0000.00717.41
8.1.110.0060.00317.41
8.1.100.0000.00817.54
8.1.90.0030.00617.53
8.1.80.0040.00417.42
8.1.70.0040.00417.50
8.1.60.0040.00417.54
8.1.50.0060.00317.48
8.1.40.0000.00917.53
8.1.30.0030.00517.61
8.1.20.0040.00417.60
8.1.10.0030.00617.65
8.1.00.0040.00417.49
8.0.300.0000.00818.77
8.0.290.0060.00316.75
8.0.280.0080.00018.49
8.0.270.0040.00416.93
8.0.260.0000.01018.46
8.0.250.0040.00417.09
8.0.240.0070.00017.01
8.0.230.0000.00717.10
8.0.220.0080.00316.97
8.0.210.0040.00416.95
8.0.200.0030.00317.02
8.0.190.0030.00616.96
8.0.180.0080.00017.09
8.0.170.0060.00316.96
8.0.160.0060.00616.97
8.0.150.0080.00016.93
8.0.140.0000.00817.02
8.0.130.0040.00715.19
8.0.120.0080.00416.95
8.0.110.0090.00517.00
8.0.100.0090.00516.93
8.0.90.0030.01116.95
8.0.80.0090.00916.96
8.0.70.0050.00916.93
8.0.60.0070.00716.94
8.0.50.0070.00716.89
8.0.30.0130.00817.13
8.0.20.0210.01217.07
8.0.10.0090.00417.03
8.0.00.0110.00816.91
7.4.330.0030.00315.55
7.4.320.0030.00316.56
7.4.300.0030.00316.61
7.4.290.0040.00416.53
7.4.280.0110.00016.56
7.4.270.0030.00716.57
7.4.260.0040.00416.55
7.4.250.0110.00316.51
7.4.240.0120.00316.50
7.4.230.0100.00616.45
7.4.220.0080.00516.62
7.4.210.0060.01016.56
7.4.200.0060.00716.48
7.4.190.0120.00616.63
7.4.180.0130.00616.65
7.4.160.0140.00516.47
7.4.150.0090.00916.51
7.4.140.0120.00717.20
7.4.130.0120.00916.57
7.4.120.0150.00516.51
7.4.110.0120.01116.51
7.4.100.0110.00916.56
7.4.90.0090.01316.63
7.4.80.0140.00917.92
7.4.70.0160.00616.46
7.4.60.0080.01116.46
7.4.50.0080.00916.29
7.4.40.0110.00816.46
7.4.30.0190.00016.48
7.4.20.0090.00916.27
7.4.10.0140.00516.27
7.4.00.0100.00815.75
7.3.330.0020.00514.86
7.3.320.0100.00214.74
7.3.310.0100.00316.43
7.3.300.0090.00516.34
7.3.290.0100.00516.32
7.3.280.0140.00416.33
7.3.270.0160.00416.17
7.3.260.0110.01016.52
7.3.250.0170.00016.48
7.3.240.0110.01116.51
7.3.230.0110.00816.39
7.3.220.0120.00416.30
7.3.210.0150.00516.30
7.3.200.0130.00916.31
7.3.190.0140.00416.36
7.3.180.0110.00616.26
7.3.170.0160.00616.44
7.3.160.0140.00616.31
7.3.150.0090.01216.17
7.3.140.0160.00416.39
7.3.130.0130.00316.22
7.3.120.0090.00316.20
7.3.110.0150.00616.12
7.3.100.0170.00316.28
7.3.90.0100.01016.62
7.3.80.0150.00316.29
7.3.70.0100.00516.16
7.3.60.0140.00515.57
7.3.50.0130.00515.59
7.3.40.0130.00815.57
7.3.30.0100.00715.54
7.3.20.0120.00717.41
7.3.10.0100.00617.25
7.3.00.0050.01417.38
7.2.340.0060.00616.53
7.2.330.0150.00816.56
7.2.320.0100.01016.61
7.2.310.0140.00516.46
7.2.300.0130.01116.48
7.2.290.0140.00616.64
7.2.280.0110.00816.30
7.2.270.0110.00716.45
7.2.260.0180.00016.23
7.2.250.0190.00016.30
7.2.240.0190.00016.41
7.2.230.0190.00016.31
7.2.220.0140.00616.38
7.2.210.0170.00616.33
7.2.200.0160.00416.30
7.2.190.0130.00315.73
7.2.180.0090.00715.78
7.2.170.0100.00615.86
7.2.160.0100.00715.80
7.2.150.0120.00617.60
7.2.140.0170.00817.71
7.2.130.0110.00817.86
7.2.120.0160.00417.73
7.2.110.0050.01216.77
7.2.100.0100.00717.62
7.2.90.0080.00817.76
7.2.80.0160.00417.63
7.2.70.0090.00817.76
7.2.60.0130.00417.60
7.2.50.0120.00417.69
7.2.40.0160.00716.61
7.2.30.0090.01017.73
7.2.20.0120.00917.84
7.2.10.0140.00617.68
7.2.00.0160.00617.68
7.1.330.0170.00017.42
7.1.320.0120.00617.20
7.1.310.0140.00317.23
7.1.300.0110.00516.57
7.1.290.0110.00616.43
7.1.280.0100.00616.49
7.1.270.0100.00616.63
7.1.260.0130.00816.60
7.1.250.0110.00916.51
7.1.240.0150.00317.14
7.1.230.0110.00717.24
7.1.220.0130.00517.13
7.1.210.0120.00617.34
7.1.200.0140.00417.17
7.1.190.0160.00317.37
7.1.180.0180.00017.32
7.1.170.0170.00017.20
7.1.160.0100.00817.17
7.1.150.0180.00017.37
7.1.140.0180.00017.27
7.1.130.0110.00817.19
7.1.120.0150.00417.16
7.1.110.0120.00617.07
7.1.100.0140.00517.18
7.1.90.0150.00317.16
7.1.80.0130.00417.23
7.1.70.0180.00017.07
7.1.60.0070.01117.16
7.1.50.0180.00017.38
7.1.40.0170.00217.43
7.1.30.0090.00917.29
7.1.20.0190.00017.29
7.1.10.0150.00617.20
7.1.00.0110.00717.23

preferences:
61.64 ms | 401 KiB | 5 Q