3v4l.org

run code in 300+ PHP versions simultaneously
<?php # some text strings for digging the broken fputcsv() issue of php5-7(current) # .. and maybe related tests broken too due to using fgetcsv() for validation resulting # in reverting hiddenly "fixing a bad csv output # --> compare the output strings direct in php-src tests instead using fgetcsv() maybe? # related rfc4180: https://tools.ietf.org/html/rfc4180 $row = array(); $row[] = 'test \" test'; # should be "test \"" test",... in the normal csv $row[] = "bbb\80 b"; $row[] = ''; # ..,,.. $row[] = '""'; # either ..,"""""", $row[] = '"c c\"'; # should be ..,"""c c\""" in the normal csv $row[] = '\0'; $row[] = "\0"; $row[] = "\80\0"; $row[] = 'lulu\0'; $row[] = "\0 lala"; $row[] = '💩'; # pile of poop unicode $row[] = 'colend'; $fp = fopen('php://memory', 'w+'); fputcsv($fp, $row); rewind($fp); print_r(stream_get_contents($fp)); fclose($fp); $fp2 = fopen('php://memory', 'w+'); # This should be the default parameters for fputcsv, IMHO # But it is not working at least up to 2017-10-07 fputcsv($fp2, $row, ',', '"','"'); rewind($fp2); print_r(stream_get_contents($fp2)); fclose($fp2); $fp3 = fopen('php://memory', 'w+'); fputcsv($fp3, $row, ',', '"',"\0"); rewind($fp3); print_r(stream_get_contents($fp3)); fclose($fp3); $fp4 = fopen('php://memory', 'w+'); # just use a normal char as just for comparing with the other variants fputcsv($fp4, $row, ',', '"','X'); rewind($fp4); print_r(stream_get_contents($fp4)); fclose($fp4); # !Results should be compared binary too as some chars maybe are not printed or cut, for instance with hexdump -C

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.60.0070.00718.43
8.3.50.0040.01118.17
8.3.40.0110.00418.68
8.3.30.0110.00718.54
8.3.20.0000.00720.16
8.3.10.0080.00022.06
8.3.00.0080.00023.66
8.2.180.0120.00617.00
8.2.170.0110.01122.96
8.2.160.0100.00722.13
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0040.00422.25
8.2.120.0070.00026.35
8.2.110.0030.00619.24
8.2.100.0040.00718.09
8.2.90.0040.00419.05
8.2.80.0060.00317.97
8.2.70.0040.00418.04
8.2.60.0040.00417.63
8.2.50.0050.00318.10
8.2.40.0000.00720.46
8.2.30.0050.00219.38
8.2.20.0030.00618.08
8.2.10.0000.00718.00
8.2.00.0040.00418.16
8.1.280.0140.00025.92
8.1.270.0030.00520.45
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0000.01021.05
8.1.230.0080.00320.49
8.1.220.0050.00317.79
8.1.210.0000.00818.77
8.1.200.0060.00317.10
8.1.190.0000.00817.53
8.1.180.0040.00418.10
8.1.170.0080.00018.49
8.1.160.0060.00318.78
8.1.150.0000.00820.06
8.1.140.0040.00417.69
8.1.130.0000.00717.48
8.1.120.0000.00717.44
8.1.110.0060.00317.45
8.1.100.0040.00417.42
8.1.90.0000.01117.46
8.1.80.0030.00617.33
8.1.70.0040.00417.35
8.1.60.0000.00817.59
8.1.50.0080.00017.50
8.1.40.0000.00817.43
8.1.30.0040.00417.53
8.1.20.0000.00817.69
8.1.10.0050.00317.54
8.1.00.0000.00917.29
8.0.300.0040.00418.77
8.0.290.0040.00416.88
8.0.280.0030.00318.41
8.0.270.0000.00817.32
8.0.260.0030.00316.74
8.0.250.0080.00016.98
8.0.240.0000.00816.92
8.0.230.0030.00316.98
8.0.220.0040.00416.93
8.0.210.0080.00016.91
8.0.200.0030.00316.95
8.0.190.0000.00816.98
8.0.180.0040.00416.94
8.0.170.0090.00017.03
8.0.160.0000.00816.96
8.0.150.0110.00016.91
8.0.140.0000.00916.90
8.0.130.0030.00313.41
8.0.120.0030.00516.77
8.0.110.0040.00416.94
8.0.100.0030.00516.93
8.0.90.0070.00016.76
8.0.80.0070.00716.90
8.0.70.0050.00216.89
8.0.60.0050.00317.03
8.0.50.0040.00417.00
8.0.30.0090.00817.15
8.0.20.0110.01017.40
8.0.10.0020.00516.96
8.0.00.0040.01516.84
7.4.330.0020.00215.55
7.4.320.0070.00016.60
7.4.300.0060.00016.49
7.4.290.0090.00016.54
7.4.280.0060.00316.38
7.4.270.0000.00816.48
7.4.260.0030.00316.39
7.4.250.0000.00716.43
7.4.240.0040.00416.48
7.4.230.0030.00316.69
7.4.220.0030.00316.61
7.4.210.0040.01116.53
7.4.200.0040.00416.35
7.4.160.0120.00616.55
7.4.150.0130.00317.40
7.4.140.0090.01317.86
7.4.130.0060.01516.45
7.4.120.0060.01216.62
7.4.110.0120.00616.58
7.4.100.0090.00916.46
7.4.90.0100.00716.49
7.4.80.0100.01319.39
7.4.70.0100.01316.45
7.4.60.0100.00616.49
7.4.50.0090.01216.52
7.4.40.0070.01016.34
7.4.30.0130.00316.31
7.4.10.0000.01414.72
7.4.00.0050.01315.07
7.3.330.0000.00513.13
7.3.320.0030.00313.04
7.3.310.0030.00316.22
7.3.300.0040.00416.28
7.3.290.0120.00616.24
7.3.280.0050.00916.25
7.3.270.0180.00417.40
7.3.260.0110.00616.29
7.3.250.0130.00416.38
7.3.240.0150.00516.37
7.3.230.0060.01316.24
7.3.210.0200.00316.16
7.3.200.0100.00716.44
7.3.190.0100.00516.32
7.3.180.0100.00516.29
7.3.170.0090.00616.40
7.3.160.0070.01016.21
7.3.130.0120.00614.23
7.3.120.0120.00614.88
7.3.110.0060.00914.52
7.3.100.0040.01214.83
7.3.90.0070.00314.50
7.3.80.0000.01314.44
7.3.70.0080.00814.44
7.3.60.0070.00414.66
7.3.50.0100.00614.92
7.3.40.0030.01214.47
7.3.30.0070.00714.54
7.3.20.0030.00916.50
7.3.10.0090.00616.33
7.3.00.0070.01016.04
7.2.330.0070.01016.39
7.2.320.0100.00616.65
7.2.310.0120.00916.48
7.2.300.0180.00016.55
7.2.290.0110.00616.44
7.2.260.0110.00714.95
7.2.250.0080.00814.74
7.2.240.0090.00614.67
7.2.230.0070.01114.71
7.2.220.0040.01115.12
7.2.210.0060.00614.80
7.2.200.0130.00315.11
7.2.190.0000.01114.74
7.2.180.0030.01015.06
7.2.170.0090.00914.66
7.2.160.0070.01014.74
7.2.150.0060.00316.82
7.2.140.0030.00716.76
7.2.130.0040.01416.95
7.2.120.0030.00716.63
7.2.110.0060.00916.77
7.2.100.0060.01016.82
7.2.90.0030.01016.66
7.2.80.0000.01116.84
7.2.70.0030.00616.95
7.2.60.0040.01116.66
7.2.50.0080.00416.81
7.2.40.0060.00916.81
7.2.30.0070.00316.73
7.2.20.0060.00916.73
7.2.10.0030.01016.52
7.2.00.0090.00616.91
7.1.330.0090.00615.39
7.1.320.0090.00615.75
7.1.310.0080.00515.45
7.1.300.0000.00915.55
7.1.290.0030.01315.40
7.1.280.0080.00815.29
7.1.270.0100.00315.34
7.1.260.0000.01215.21
7.1.250.0040.01115.80
7.1.240.0030.01015.70
7.1.230.0060.00615.36
7.1.220.0090.00415.41
7.1.210.0000.01215.57
7.1.200.0070.01015.51
7.1.190.0030.00615.60
7.1.180.0090.00315.74
7.1.170.0060.00615.70
7.1.160.0030.00515.46
7.1.150.0000.00815.61
7.1.140.0090.00315.70
7.1.130.0040.00715.74
7.1.120.0000.01015.61
7.1.110.0060.00615.69
7.1.100.2360.01015.89
7.1.90.2190.00416.02
7.1.80.2190.01315.81
7.1.70.2340.00815.35
7.1.60.2570.00824.55
7.1.50.2070.00824.28
7.1.40.0220.01324.21
7.1.30.0230.01124.15
7.1.20.0160.01624.12
7.1.10.0130.00615.33
7.1.00.0620.01215.12
7.0.330.0060.00315.45
7.0.320.0030.01015.04
7.0.310.0020.00515.35
7.0.300.0090.00615.11
7.0.290.0070.00415.41
7.0.280.0090.00315.38
7.0.270.0000.01015.32
7.0.260.0030.00915.45
7.0.250.0060.00615.36
7.0.240.1770.00515.61
7.0.230.2240.00715.60
7.0.220.2180.01215.71
7.0.210.2140.00515.22
7.0.200.2810.01215.20
7.0.190.2170.00514.95
7.0.180.1120.01014.84
7.0.170.0050.01314.76
7.0.160.0110.01314.64
7.0.150.0080.01014.82
7.0.140.0100.00614.70
7.0.130.0070.01014.92
7.0.120.0070.01015.16
7.0.110.0070.01214.90
7.0.100.0060.01014.79
7.0.90.0960.00814.94
7.0.80.0110.01014.94
7.0.70.2850.00715.08
7.0.60.1650.01214.72
7.0.50.0100.00315.12
7.0.40.0110.00514.01
7.0.30.0120.00514.30
7.0.20.0050.01013.98
7.0.10.0080.00814.08
7.0.00.0060.00814.01
5.6.400.0030.01014.13
5.6.390.0030.00613.72
5.6.380.0090.00614.68
5.6.370.0000.00914.36
5.6.360.0080.00514.08
5.6.350.0030.00914.37
5.6.340.0000.01414.61
5.6.330.0060.01214.37
5.6.320.0100.00314.36
5.6.310.0120.00314.18
5.6.300.0110.00414.25
5.6.290.0030.00914.18
5.6.280.0040.01114.39
5.6.270.0000.01314.29
5.6.260.0040.00414.46
5.6.250.0080.00314.68
5.6.240.0040.01214.40
5.6.230.0000.01614.56
5.6.220.0120.00613.99
5.6.210.0060.00914.18
5.6.200.0060.00314.43
5.6.190.0090.00314.07
5.6.180.0080.00314.17
5.6.170.0060.00614.17
5.6.160.0000.00814.26
5.6.150.0000.00814.31
5.6.140.0090.00014.22
5.6.130.0000.01314.30
5.6.120.0030.01014.34
5.6.110.0100.00313.96
5.6.100.0060.00913.96
5.6.90.0060.00914.46
5.6.80.0100.00714.13
5.6.70.0130.00313.91
5.6.60.0000.01314.05
5.6.50.0070.00713.82
5.6.40.0000.01113.87
5.6.30.0090.00314.14
5.6.20.0000.01713.98
5.6.10.0070.00714.16
5.6.00.0030.01313.97

preferences:
109.4 ms | 401 KiB | 5 Q