3v4l.org

run code in 300+ PHP versions simultaneously
<?php function fputcsvdata($dataArray,$delimiter,$enclosure) { // Write a line to a file // $filePointer = the file resource to write to // $dataArray = the data to write out // $delimeter = the field separator // Build the string $string = ""; // No leading delimiter $writeDelimiter = FALSE; foreach($dataArray as $dataElement) { // Replaces a double quote with two double quotes $dataElement=str_replace("\"", "\"\"", $dataElement); // Adds a delimiter before each field (except the first) if($writeDelimiter) $string .= $delimiter; // Encloses each field with $enclosure and adds it to the string $string .= $enclosure . $dataElement . $enclosure; // Delimiters are used every time except the first. $writeDelimiter = TRUE; } // end foreach($dataArray as $dataElement) // Append new line $string .= "\n"; return $string; } $data = array('this','is some', 'csv "stuff", you know.', 1, ''); var_dump(fputcsvdata($data, ',', '"')); //$out = fopen('php://output', 'w'); //fputcsv($out, $data); //fclose($out);

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.01016.75
8.3.50.0080.01018.29
8.3.40.0040.01118.68
8.3.30.0140.00018.84
8.3.20.0080.00018.60
8.3.10.0090.00020.41
8.3.00.0000.00819.38
8.2.180.0100.00618.29
8.2.170.0110.01122.96
8.2.160.0120.00620.55
8.2.150.0070.00324.18
8.2.140.0060.00324.66
8.2.130.0050.00226.16
8.2.120.0040.00420.58
8.2.110.0030.00619.24
8.2.100.0070.00417.84
8.2.90.0020.00719.48
8.2.80.0000.00919.17
8.2.70.0060.00317.63
8.2.60.0040.00417.93
8.2.50.0040.00418.07
8.2.40.0000.00818.34
8.2.30.0050.00518.06
8.2.20.0060.00319.51
8.2.10.0040.00417.68
8.2.00.0000.00717.63
8.1.280.0190.00325.92
8.1.270.0000.00724.66
8.1.260.0040.00426.35
8.1.250.0030.00528.09
8.1.240.0060.00322.66
8.1.230.0120.00020.91
8.1.220.0030.00617.74
8.1.210.0000.00918.86
8.1.200.0030.00617.35
8.1.190.0000.00917.51
8.1.180.0080.00018.10
8.1.170.0050.00318.85
8.1.160.0000.00718.88
8.1.150.0000.00718.64
8.1.140.0070.00017.38
8.1.130.0040.00417.70
8.1.120.0000.00717.50
8.1.110.0050.00317.40
8.1.100.0040.00417.49
8.1.90.0030.00317.29
8.1.80.0070.00017.34
8.1.70.0070.00017.36
8.1.60.0050.00217.58
8.1.50.0040.00417.48
8.1.40.0000.00817.52
8.1.30.0030.00517.66
8.1.20.0000.00717.66
8.1.10.0050.00217.53
8.1.00.0050.00317.43
8.0.300.0030.00319.96
8.0.290.0060.00316.75
8.0.280.0030.00318.36
8.0.270.0040.00417.19
8.0.260.0000.00816.73
8.0.250.0080.00016.97
8.0.240.0030.00516.96
8.0.230.0080.00016.88
8.0.220.0070.00016.81
8.0.210.0000.00716.76
8.0.200.0050.00216.86
8.0.190.0040.00416.97
8.0.180.0050.00216.91
8.0.170.0030.00516.88
8.0.160.0020.00516.76
8.0.150.0070.00016.74
8.0.140.0040.00416.84
8.0.130.0000.00613.28
8.0.120.0070.00016.79
8.0.110.0000.00816.86
8.0.100.0070.00016.75
8.0.90.0040.00416.84
8.0.80.0070.01416.85
8.0.70.0050.00316.77
8.0.60.0080.00016.68
8.0.50.0070.00016.92
8.0.30.0100.01017.01
8.0.20.0050.01717.00
8.0.10.0040.00416.88
8.0.00.0090.00916.95
7.4.330.0020.00212.93
7.4.320.0000.00616.51
7.4.300.0060.00016.52
7.4.290.0070.00016.65
7.4.280.0050.00316.63
7.4.270.0000.00616.52
7.4.260.0030.00313.39
7.4.250.0000.00816.51
7.4.240.0030.00316.63
7.4.230.0000.00716.50
7.4.220.0120.00616.64
7.4.210.0060.01016.71
7.4.200.0000.00716.25
7.4.190.0000.00716.69
7.4.160.0070.01016.61
7.4.150.0150.00316.47
7.4.140.0090.00916.35
7.4.130.0030.01316.53
7.4.120.0130.00316.46
7.4.110.0030.01316.60
7.4.100.0100.00716.55
7.4.90.0120.00916.64
7.4.80.0100.01319.39
7.4.70.0130.00316.44
7.4.60.0100.00716.50
7.4.50.0000.00516.19
7.4.40.0040.01516.49
7.4.30.0060.01016.54
7.4.10.0110.00515.17
7.4.00.0080.01014.87
7.3.330.0050.00013.36
7.3.320.0030.00313.18
7.3.310.0060.00016.38
7.3.300.0040.00416.21
7.3.290.0070.00816.37
7.3.280.0060.01116.35
7.3.270.0040.01516.32
7.3.260.0070.01016.43
7.3.250.0130.00616.37
7.3.240.0030.01416.31
7.3.230.0070.01116.58
7.3.210.0100.00616.39
7.3.200.0170.00016.45
7.3.190.0090.00616.72
7.3.180.0030.01216.36
7.3.170.0080.00916.45
7.3.160.0100.00616.29
7.3.130.0090.00614.75
7.3.120.0070.01014.75
7.3.110.0060.01214.84
7.3.100.0120.00414.88
7.3.90.0100.01015.02
7.3.80.0040.00714.62
7.3.70.0110.00315.00
7.3.60.0060.00614.98
7.3.50.0040.01114.79
7.3.40.0030.01114.72
7.3.30.0070.00714.79
7.3.20.0070.01016.65
7.3.10.0110.00616.40
7.3.00.0030.01216.47
7.2.330.0100.00716.37
7.2.320.0120.00616.77
7.2.310.0080.01516.59
7.2.300.0100.00716.73
7.2.290.0070.01516.70
7.2.260.0070.01115.15
7.2.250.0120.00615.26
7.2.240.0100.00315.00
7.2.230.0100.00615.20
7.2.220.0070.00715.05
7.2.210.0030.00615.27
7.2.200.0030.00915.13
7.2.190.0030.01015.17
7.2.180.0000.01015.17
7.2.170.0030.01015.02
7.2.160.0130.00014.95
7.2.150.0060.00616.84
7.2.140.0040.01116.90
7.2.130.0070.00916.72
7.2.120.0040.01516.79
7.2.110.0080.01116.56
7.2.100.0080.01116.66
7.2.90.0120.01116.65
7.2.80.0090.01316.81
7.2.70.0140.00616.81
7.2.60.0120.00616.70
7.2.50.0090.01216.82
7.2.40.0080.01416.58
7.2.30.0130.00916.80
7.2.20.0080.00916.68
7.2.10.0050.01216.90
7.2.00.0080.00817.42
7.1.330.0080.00815.79
7.1.320.0000.00916.02
7.1.310.0070.00715.84
7.1.300.0040.01215.60
7.1.290.0060.00615.73
7.1.280.0070.00715.84
7.1.270.0070.00715.52
7.1.260.0000.01315.78
7.1.250.0080.00815.52
7.1.240.0060.01015.88
7.1.230.0090.00015.91
7.1.220.0100.00315.68
7.1.210.0070.00415.90
7.1.200.0020.01315.94
7.1.190.0040.01115.76
7.1.180.0050.00515.63
7.1.170.0070.01015.69
7.1.160.0090.00615.46
7.1.150.0030.00915.56
7.1.140.0110.00015.82
7.1.130.0000.01215.94
7.1.120.0000.00915.66
7.1.110.0090.00615.49
7.1.100.0070.00416.88
7.1.90.0030.00515.98
7.1.80.0070.01015.71
7.1.70.0020.00516.28
7.1.60.0080.00917.39
7.1.50.0070.01016.38
7.1.40.0080.00316.05
7.1.30.0030.01315.95
7.1.20.0130.00015.77
7.1.10.0090.00315.93
7.1.00.0030.04319.04
7.0.330.0030.01015.44
7.0.320.0070.00715.11
7.0.310.0070.00715.45
7.0.300.0030.01315.51
7.0.290.0000.01315.32
7.0.280.0030.00615.63
7.0.270.0040.00715.24
7.0.260.0090.00915.51
7.0.250.0030.00915.65
7.0.240.0060.00615.53
7.0.230.0030.01015.56
7.0.220.0110.00315.55
7.0.210.0040.00815.58
7.0.200.0090.00116.06
7.0.190.0000.00815.44
7.0.180.0040.01215.52
7.0.170.0100.00315.49
7.0.160.0100.00315.52
7.0.150.0090.00315.29
7.0.140.0080.03618.76
7.0.130.0130.00315.61
7.0.120.0060.03018.77
7.0.110.0060.00315.51
7.0.100.0070.00315.19
7.0.90.0040.00415.43
7.0.80.0030.01015.59
7.0.70.0060.00615.40
7.0.60.0030.04917.66
7.0.50.0080.03716.75
7.0.40.0130.04016.78
7.0.30.0250.03816.86
7.0.20.0220.04016.83
7.0.10.0050.04616.74
7.0.00.0070.04516.94
5.6.400.0060.00314.79
5.6.390.0060.00914.47
5.6.380.0000.00914.61
5.6.370.0100.00714.05
5.6.360.0040.01414.17
5.6.350.0060.01314.52
5.6.340.0070.00714.41
5.6.330.0040.01114.41
5.6.320.0030.00914.36
5.6.310.0060.00914.50
5.6.300.0060.00314.33
5.6.290.0080.00814.42
5.6.280.0020.04417.76
5.6.270.0100.00314.47
5.6.260.0030.01014.71
5.6.250.0060.00614.41
5.6.240.0040.01114.32
5.6.230.0000.01514.44
5.6.220.0080.00414.25
5.6.210.0070.04517.59
5.6.200.0040.02516.28
5.6.190.0100.02817.41
5.6.180.0190.03017.40
5.6.170.0220.03017.49
5.6.160.0070.04717.43
5.6.150.0080.03016.31
5.6.140.0070.02416.29
5.6.130.0080.04516.17
5.6.120.0130.04217.66
5.6.110.0050.05017.73
5.6.100.0070.02217.66
5.6.90.0080.02717.62
5.6.80.0060.03917.38
5.6.70.0030.01014.43
5.6.60.0060.00914.43
5.6.50.0000.00914.26
5.6.40.0150.00014.07
5.6.30.0000.01414.59
5.6.20.0030.00614.20
5.6.10.0040.00714.29
5.6.00.0090.00614.45
5.5.380.0080.00414.21
5.5.370.0040.00414.06
5.5.360.0080.00413.99
5.5.350.0190.03517.39
5.5.340.0050.03016.15
5.5.330.0070.03317.21
5.5.320.0290.03317.23
5.5.310.0260.03517.23
5.5.300.0080.02516.17
5.5.290.0090.04316.08
5.5.280.0050.04417.44
5.5.270.0060.02517.65
5.5.260.0080.03117.35
5.5.250.0080.03017.54
5.5.240.0100.02517.13
5.5.230.0060.00614.36
5.5.220.0080.00614.14
5.5.210.0000.01114.53
5.5.200.0060.00914.47
5.5.190.0120.00014.28
5.5.180.0040.00814.15
5.5.170.0000.01314.27
5.5.160.0000.01514.36
5.5.150.0070.00714.36
5.5.140.0070.00714.09
5.5.130.0070.00714.45
5.5.120.0030.00714.34
5.5.110.0060.00314.23
5.5.100.0040.00814.24
5.5.90.0000.01314.33
5.5.80.0030.00713.89
5.5.70.0030.00714.22
5.5.60.0060.00914.40
5.5.50.0040.00814.18
5.5.40.0090.00014.11
5.5.30.0120.00314.09
5.5.20.0000.01414.07
5.5.10.0080.00814.13
5.5.00.0030.01013.91
5.4.450.0090.03316.38
5.4.440.0070.04316.45
5.4.430.0080.02316.40
5.4.420.0020.04616.31
5.4.410.0100.03016.36
5.4.400.0060.03016.26
5.4.390.0020.02716.19
5.4.380.0060.03716.26
5.4.370.0080.03716.26
5.4.360.0020.03116.14
5.4.350.0050.02716.30
5.4.340.0060.03116.30
5.4.330.0030.00913.37
5.4.320.0050.03216.26
5.4.310.0050.02816.30
5.4.300.0060.04016.29
5.4.290.0120.03016.12
5.4.280.0030.04416.18
5.4.270.0100.03816.17
5.4.260.0100.01516.30
5.4.250.0050.03416.30
5.4.240.0040.03516.30
5.4.230.0080.03716.25
5.4.220.0080.02316.11
5.4.210.0100.03716.10
5.4.200.0040.02616.25
5.4.190.0050.04516.30
5.4.180.0050.02216.22
5.4.170.0020.04216.18
5.4.160.0060.03616.25
5.4.150.0060.04016.25
5.4.140.0080.02714.90
5.4.130.0070.03914.86
5.4.120.0020.03514.96
5.4.110.0050.02515.02
5.4.100.0000.02414.84
5.4.90.0080.03514.89
5.4.80.0050.02814.83
5.4.70.0050.04014.84
5.4.60.0050.01814.89
5.4.50.0020.02114.88
5.4.40.0050.03414.91
5.4.30.0050.03214.89
5.4.20.0020.03014.89
5.4.10.0110.03814.90
5.4.00.0030.04014.57
5.3.290.0070.03714.03
5.3.280.0030.03813.98
5.3.270.0050.02314.00
5.3.260.0050.03014.01
5.3.250.0030.03813.98
5.3.240.0030.02514.01
5.3.230.0030.03113.99
5.3.220.0060.02014.04
5.3.210.0050.02313.97
5.3.200.0020.03013.97
5.3.190.0060.02814.04
5.3.180.0030.03913.91
5.3.170.0080.03714.04
5.3.160.0020.02413.92
5.3.150.0040.02014.04
5.3.140.0150.03314.00
5.3.130.0070.03713.96
5.3.120.0060.02713.96
5.3.110.0090.02214.03
5.3.100.0060.02913.71
5.3.90.0050.04013.70
5.3.80.0050.03513.77
5.3.70.0050.04213.73
5.3.60.0020.04313.71
5.3.50.0080.03713.73
5.3.40.0040.03113.66
5.3.30.0030.02513.64
5.3.20.0060.02413.56
5.3.10.0050.03713.48
5.3.00.0020.02813.50
5.2.170.0070.04011.18
5.2.160.0130.05011.09
5.2.150.0030.06311.11
5.2.140.0000.03311.20
5.2.130.0070.05011.16
5.2.120.0070.04711.07
5.2.110.0070.03011.25
5.2.100.0070.03011.26
5.2.90.0100.05711.09
5.2.80.0130.04011.24
5.2.70.0070.05311.15
5.2.60.0070.06311.06
5.2.50.0030.05311.06
5.2.40.0030.04310.95
5.2.30.0030.03011.02
5.2.20.0100.04711.01
5.2.10.0070.02710.78
5.2.00.0100.03010.71
5.1.60.0070.04710.00
5.1.50.0130.03710.05
5.1.40.0070.0509.97
5.1.30.0030.02710.30
5.1.20.0000.05010.34
5.1.10.0070.05310.07
5.1.00.0030.05310.23
5.0.50.0070.0438.57
5.0.40.0100.0378.39
5.0.30.0030.0538.29
5.0.20.0030.0208.20
5.0.10.0030.0478.20
5.0.00.0000.0678.30
4.4.90.0000.0178.20
4.4.80.0070.0338.20
4.4.70.0000.0238.20
4.4.60.0000.0238.20
4.4.50.0000.0378.20
4.4.40.0000.0278.20
4.4.30.0000.0208.20
4.4.20.0070.0108.20
4.4.10.0030.0338.20
4.4.00.0000.0508.20
4.3.110.0070.0278.20
4.3.100.0000.0208.20
4.3.90.0000.0338.20
4.3.80.0030.0538.20
4.3.70.0070.0278.20
4.3.60.0070.0208.20
4.3.50.0000.0378.20
4.3.40.0070.0508.20
4.3.30.0000.0308.20
4.3.20.0000.0338.20
4.3.10.0070.0278.20
4.3.00.0000.0178.20

preferences:
43.87 ms | 401 KiB | 5 Q