3v4l.org

run code in 300+ PHP versions simultaneously
<?php # some text strings for digging the broken fputcsv() of php5-7(current) # .. and maybe related tests broken too due too using bad default fgetcsv() behavior # related rfc4180: https://tools.ietf.org/html/rfc4180 $row = array(); $row[] = 'test \" test'; # should be "test \"" test" in the normal csv $row[] = 'bbb'; $row[] = ''; # ..,,.. $row[] = '""'; # either ..,"""""", $row[] = '"c c\"'; # should be ..,"""c c\""" in the normal csv $row[] = '\0'; $row[] = "\0"; $row[] = 'lulu\0'; $row[] = "\0 lala"; $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.0040.01118.30
8.3.50.0100.00718.07
8.3.40.0070.00718.80
8.3.30.0090.00518.67
8.3.20.0070.00020.16
8.3.10.0080.00021.92
8.3.00.0040.00423.71
8.2.180.0130.00618.41
8.2.170.0040.01122.96
8.2.160.0070.00722.13
8.2.150.0030.00624.18
8.2.140.0070.00024.66
8.2.130.0080.00020.37
8.2.120.0070.00026.35
8.2.110.0030.00721.02
8.2.100.0080.00318.03
8.2.90.0000.00819.22
8.2.80.0000.00817.97
8.2.70.0090.00017.75
8.2.60.0000.00718.05
8.2.50.0100.00018.22
8.2.40.0050.00320.42
8.2.30.0040.00419.18
8.2.20.0000.00718.09
8.2.10.0000.00818.01
8.2.00.0040.00418.10
8.1.280.0090.00625.92
8.1.270.0060.00320.07
8.1.260.0050.00226.35
8.1.250.0040.00428.09
8.1.240.0030.00722.65
8.1.230.0070.00420.31
8.1.220.0050.00317.74
8.1.210.0080.00018.77
8.1.200.0060.00317.22
8.1.190.0060.00317.10
8.1.180.0000.00718.10
8.1.170.0030.00618.49
8.1.160.0030.00618.89
8.1.150.0050.00220.11
8.1.140.0000.00717.66
8.1.130.0070.00019.00
8.1.120.0040.00417.43
8.1.110.0070.00017.34
8.1.100.0040.00417.39
8.1.90.0000.01017.44
8.1.80.0000.00717.48
8.1.70.0000.00817.44
8.1.60.0080.00317.61
8.1.50.0040.00417.45
8.1.40.0030.00617.39
8.1.30.0040.00417.64
8.1.20.0000.00917.60
8.1.10.0000.00717.50
8.1.00.0060.00317.46
8.0.300.0020.00518.77
8.0.290.0040.00416.75
8.0.280.0030.00318.45
8.0.270.0000.00817.36
8.0.260.0070.00018.39
8.0.250.0040.00416.92
8.0.240.0080.00017.00
8.0.230.0040.00416.88
8.0.220.0040.00416.80
8.0.210.0030.00316.86
8.0.200.0000.00716.91
8.0.190.0050.00217.02
8.0.180.0000.00716.93
8.0.170.0020.00516.83
8.0.160.0040.00316.96
8.0.150.0000.00816.87
8.0.140.0000.00816.92
8.0.130.0000.00513.41
8.0.120.0080.00016.92
8.0.110.0070.00016.92
8.0.100.0070.00016.72
8.0.90.0000.00716.73
8.0.80.0060.00916.93
8.0.70.0000.00716.89
8.0.60.0050.00316.82
8.0.50.0070.00016.87
8.0.30.0100.00816.86
8.0.20.0130.00917.40
8.0.10.0050.00316.93
8.0.00.0090.00916.68
7.4.330.0060.00015.55
7.4.320.0070.00016.46
7.4.300.0000.00616.46
7.4.290.0050.00316.42
7.4.280.0000.00816.54
7.4.270.0030.00316.37
7.4.260.0070.00016.38
7.4.250.0050.00316.45
7.4.240.0000.00716.46
7.4.230.0040.00416.49
7.4.220.0120.00616.45
7.4.210.0070.00916.56
7.4.200.0040.00416.37
7.4.160.0130.00616.55
7.4.150.0090.00817.40
7.4.140.0110.01017.86
7.4.130.0070.01716.63
7.4.120.0110.00916.50
7.4.110.0140.00416.52
7.4.100.0130.00316.67
7.4.90.0100.00716.34
7.4.80.0060.01219.39
7.4.70.0100.00616.55
7.4.60.0170.01416.45
7.4.50.0030.00916.43
7.4.40.0150.00316.56
7.4.30.0100.01016.51
7.4.10.0080.00914.79
7.4.00.0070.00914.98
7.3.330.0050.00013.31
7.3.320.0000.00613.23
7.3.310.0070.00016.22
7.3.300.0050.00216.33
7.3.290.0070.00716.28
7.3.280.0090.00816.29
7.3.270.0070.01117.40
7.3.260.0100.00716.38
7.3.250.0130.00616.34
7.3.240.0110.00816.40
7.3.230.0040.01716.31
7.3.210.0070.01116.45
7.3.200.0120.00916.18
7.3.190.0040.01116.57
7.3.180.0110.00416.39
7.3.170.0040.01216.46
7.3.160.0060.01016.07
7.3.130.0090.00914.57
7.3.120.0100.00614.46
7.3.110.0140.00014.80
7.3.100.0030.01414.70
7.3.90.0090.00914.74
7.3.80.0030.01314.35
7.3.70.0040.01514.55
7.3.60.0070.01014.80
7.3.50.0100.00314.65
7.3.40.0030.01214.50
7.3.30.0070.00714.68
7.3.20.0090.00316.60
7.3.10.0020.01316.24
7.3.00.0010.00916.44
7.2.330.0120.00616.51
7.2.320.0080.00816.48
7.2.310.0090.00816.41
7.2.300.0090.00916.50
7.2.290.0100.01016.70
7.2.260.0070.01314.64
7.2.250.0080.01114.73
7.2.240.0090.00614.84
7.2.230.0030.01014.75
7.2.220.0070.01014.49
7.2.210.0090.00615.00
7.2.200.0030.01314.66
7.2.190.0060.00614.68
7.2.180.0030.01314.81
7.2.170.0080.00314.93
7.2.160.0120.00314.67
7.2.150.0040.01116.59
7.2.140.0040.01216.31
7.2.130.0100.00616.53
7.2.120.0050.00816.85
7.2.110.0070.00816.75
7.2.100.0100.00916.75
7.2.90.0040.00916.72
7.2.80.0070.00816.77
7.2.70.0110.00616.77
7.2.60.0110.00316.68
7.2.50.0100.00916.79
7.2.40.0090.00516.51
7.2.30.0070.00916.71
7.2.20.0070.01016.83
7.2.10.0050.00816.75
7.2.00.0050.00716.79
7.1.330.0100.00315.54
7.1.320.0000.01515.46
7.1.310.0030.00915.68
7.1.300.0000.01015.68
7.1.290.0120.00315.36
7.1.280.0060.00715.59
7.1.270.0030.01215.27
7.1.260.0030.01015.56
7.1.250.0040.00615.63
7.1.240.0100.00315.39
7.1.230.0070.01015.50
7.1.220.0080.00615.52
7.1.210.0040.01115.30
7.1.200.0040.00915.59
7.1.190.0000.01415.39
7.1.180.0040.00715.20
7.1.170.0070.00715.52
7.1.160.0030.01215.55
7.1.150.0040.01115.20
7.1.140.0040.00415.02
7.1.130.0030.01015.34
7.1.120.0060.00615.67
7.1.110.0000.00815.68
7.1.100.0740.00615.73
7.1.90.0950.00715.99
7.1.80.0940.00815.99
7.1.70.0670.00515.44
7.1.60.0810.01624.47
7.1.50.0970.01224.20
7.1.40.1150.01224.09
7.1.30.1200.00823.92
7.1.20.1290.01224.26
7.1.10.0810.00315.12
7.1.00.0630.01015.33
7.0.330.0060.00615.30
7.0.320.0000.01515.00
7.0.310.0130.00315.43
7.0.300.0090.00015.24
7.0.290.0050.00315.41
7.0.280.0060.00615.37
7.0.270.0060.01015.15
7.0.260.0000.01515.10
7.0.250.0110.00315.28
7.0.240.0650.01215.46
7.0.230.0980.00615.50
7.0.220.0850.00515.48
7.0.210.0650.00615.12
7.0.200.0850.00915.26
7.0.190.1130.00715.08
7.0.180.1180.00714.85
7.0.170.0680.01015.08
7.0.160.0760.00814.54
7.0.150.0680.00214.92
7.0.140.0740.01114.89
7.0.130.0600.00914.89
7.0.120.0620.01015.20
7.0.110.0630.00914.83
7.0.100.0820.00314.92
7.0.90.0690.00814.78
7.0.80.0680.00814.94
7.0.70.1060.01014.82
7.0.60.1120.00814.83
7.0.50.1160.01514.76
7.0.40.1060.00713.96
7.0.30.0900.00714.00
7.0.20.0660.01113.91
7.0.10.0630.01014.11
7.0.00.0730.01213.94
5.6.400.0030.01214.31
5.6.390.0030.00914.48
5.6.380.0040.00714.38
5.6.370.0130.00314.22
5.6.360.0000.01413.57
5.6.350.0040.00814.39
5.6.340.0080.00614.65
5.6.330.0030.01214.07
5.6.320.0090.00614.23
5.6.310.0060.00314.53
5.6.300.0130.00313.81
5.6.290.0060.00314.38
5.6.280.0100.00314.40
5.6.270.0080.00414.36
5.6.260.0060.00914.29
5.6.250.0090.00614.18
5.6.240.0000.01214.47
5.6.230.0060.00613.88
5.6.220.0060.00613.97
5.6.210.0000.01513.98
5.6.200.0090.00614.20
5.6.190.0040.00914.21
5.6.180.0030.01314.33
5.6.170.0070.00414.30
5.6.160.0070.00414.07
5.6.150.0000.01214.02
5.6.140.0110.00314.12
5.6.130.0130.00014.18
5.6.120.0090.00013.97
5.6.110.0030.00614.09
5.6.100.0070.00314.27
5.6.90.0000.01514.12
5.6.80.0120.00314.14
5.6.70.0030.00614.27
5.6.60.0060.00614.19
5.6.50.0100.00314.15
5.6.40.0040.01114.30
5.6.30.0000.01013.82
5.6.20.0110.00314.05
5.6.10.0000.00814.18
5.6.00.0040.01114.21

preferences:
50.74 ms | 400 KiB | 5 Q