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 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.0140.00018.55
8.3.50.0150.00418.27
8.3.40.0140.00318.89
8.3.30.0040.01118.54
8.3.20.0040.00420.39
8.3.10.0040.00422.10
8.3.00.0040.00423.71
8.2.180.0110.00418.19
8.2.170.0100.01022.96
8.2.160.0030.01021.97
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0000.00720.38
8.2.120.0040.00426.35
8.2.110.0080.00021.07
8.2.100.0090.00318.22
8.2.90.0000.00819.17
8.2.80.0000.00917.97
8.2.70.0000.00817.75
8.2.60.0050.00317.80
8.2.50.0030.00718.10
8.2.40.0030.00620.42
8.2.30.0040.00419.16
8.2.20.0000.00818.08
8.2.10.0050.00318.09
8.2.00.0040.00418.08
8.1.280.0040.01125.92
8.1.270.0090.00020.43
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0030.00722.75
8.1.230.0060.00620.46
8.1.220.0050.00317.74
8.1.210.0060.00318.77
8.1.200.0090.00017.22
8.1.190.0000.01117.22
8.1.180.0040.00418.10
8.1.170.0050.00318.59
8.1.160.0000.00918.87
8.1.150.0070.00020.06
8.1.140.0000.00717.72
8.1.130.0000.00718.96
8.1.120.0080.00017.42
8.1.110.0040.00417.38
8.1.100.0040.00417.34
8.1.90.0110.00017.32
8.1.80.0040.00417.31
8.1.70.0000.00717.26
8.1.60.0060.00617.58
8.1.50.0000.00817.53
8.1.40.0030.00517.39
8.1.30.0040.00417.59
8.1.20.0080.00017.66
8.1.10.0040.00417.36
8.1.00.0000.00817.44
8.0.300.0000.00718.77
8.0.290.0070.00016.75
8.0.280.0050.00218.36
8.0.270.0030.00517.33
8.0.260.0040.00418.47
8.0.250.0030.00316.88
8.0.240.0030.00316.94
8.0.230.0020.00516.88
8.0.220.0000.00716.98
8.0.210.0050.00316.91
8.0.200.0000.00716.96
8.0.190.0050.00316.86
8.0.180.0040.00416.96
8.0.170.0000.00716.92
8.0.160.0000.00816.98
8.0.150.0000.00716.75
8.0.140.0000.00816.89
8.0.130.0000.00613.39
8.0.120.0030.00516.86
8.0.110.0000.00716.83
8.0.100.0000.00816.86
8.0.90.0000.00716.90
8.0.80.0100.01116.90
8.0.70.0040.00416.96
8.0.60.0070.00016.80
8.0.50.0040.00416.94
8.0.30.0090.00916.92
8.0.20.0080.01117.40
8.0.10.0040.00416.99
8.0.00.0110.00816.71
7.4.330.0040.00015.55
7.4.320.0040.00416.59
7.4.300.0030.00316.39
7.4.290.0070.00016.43
7.4.280.0050.00316.61
7.4.270.0030.00316.47
7.4.260.0000.01016.56
7.4.250.0000.00816.34
7.4.240.0070.00016.60
7.4.230.0000.00716.29
7.4.220.0120.00616.57
7.4.210.0040.01116.52
7.4.200.0030.00316.29
7.4.160.0100.00616.46
7.4.150.0090.00917.40
7.4.140.0080.01217.86
7.4.130.0110.02816.34
7.4.120.0080.01216.55
7.4.110.0120.00616.46
7.4.100.0040.01416.49
7.4.90.0110.00616.46
7.4.80.0070.01419.39
7.4.70.0030.01416.48
7.4.60.0070.00816.61
7.4.50.0100.00716.40
7.4.40.0090.01016.59
7.4.30.0120.00916.63
7.4.00.0070.00914.85
7.3.330.0050.00013.04
7.3.320.0000.00513.16
7.3.310.0030.00316.12
7.3.300.0040.00416.32
7.3.290.0120.00516.27
7.3.280.0080.00916.33
7.3.270.0090.00917.40
7.3.260.0110.00516.35
7.3.250.0130.00716.42
7.3.240.0080.01016.37
7.3.230.0120.00616.32
7.3.210.0150.00316.39
7.3.200.0100.00716.59
7.3.190.0160.02916.12
7.3.180.0100.01016.32
7.3.170.0040.01216.39
7.3.160.0070.01016.55
7.3.120.0070.01114.92
7.3.110.0080.00814.88
7.3.100.0080.00814.79
7.3.90.0100.00714.80
7.3.80.0020.00914.79
7.3.70.0060.01214.79
7.3.60.0040.00914.77
7.3.50.0100.00214.89
7.3.40.0080.00614.59
7.3.30.0080.00614.83
7.3.20.0060.00816.62
7.3.10.0080.00516.54
7.3.00.0050.00616.50
7.2.330.0100.00716.72
7.2.320.0090.00916.61
7.2.310.0100.00716.75
7.2.300.0150.00716.72
7.2.290.0080.00816.72
7.2.250.0000.02014.98
7.2.240.0070.01014.94
7.2.230.0080.00814.84
7.2.220.0070.00714.96
7.2.210.0050.01014.90
7.2.200.0050.00715.02
7.2.190.0070.01015.02
7.2.180.0070.01115.00
7.2.170.0050.01114.83
7.2.160.0030.01415.02
7.2.150.0110.00416.88
7.2.140.0090.00616.87
7.2.130.0010.01316.78
7.2.120.0070.00716.84
7.2.110.0150.00616.70
7.2.100.0040.01116.65
7.2.90.0030.00916.79
7.2.80.0080.00516.92
7.2.70.0070.00716.78
7.2.60.0060.00816.75
7.2.50.0100.00516.91
7.2.40.0070.00716.69
7.2.30.0070.00916.91
7.2.20.0090.00516.87
7.2.10.0050.01016.74
7.2.00.0050.01016.70
7.1.330.0020.01415.74
7.1.320.0070.00515.62
7.1.310.0070.00715.67
7.1.300.0070.00715.69
7.1.290.0070.00515.66
7.1.280.0090.00315.74
7.1.270.0050.00915.63
7.1.260.0110.00315.60
7.1.250.0080.00615.73
7.1.200.0200.00315.36
7.1.100.2350.01015.99
7.1.90.2050.01316.48
7.1.80.1560.00016.07
7.1.70.1960.01015.37
7.1.60.2640.01433.29
7.1.50.2860.01933.06
7.1.40.2980.01332.51
7.1.30.4040.01932.60
7.1.20.2480.01332.88
7.1.10.2990.01014.80
7.1.00.2960.00714.84
7.0.240.2890.01015.55
7.0.230.1210.00715.74
7.0.220.1740.01015.81
7.0.210.1760.01014.93
7.0.200.3330.01315.04
7.0.190.4370.01014.84
7.0.180.3070.01314.58
7.0.170.4760.01714.63
7.0.160.4840.00714.63
7.0.150.2800.00714.42
7.0.140.3140.01314.41
7.0.130.3150.01714.60
7.0.120.3310.01014.47
7.0.110.2670.01014.38
7.0.100.4250.01314.71
7.0.90.3050.01014.55
7.0.80.3020.01014.70
7.0.70.2450.00714.66
7.0.60.2930.00314.47
7.0.50.3840.01014.52
7.0.40.3290.01314.55
7.0.30.3270.00914.74
7.0.20.3490.01314.71
7.0.10.3600.01014.78
7.0.00.3200.01014.59

preferences:
62.91 ms | 401 KiB | 5 Q