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; if (!is_numeric($dataElement) && !empty($dataElement)){ // Encloses each field with $enclosure and adds it to the string $string .= $enclosure . $dataElement . $enclosure; } else { $string .= $dataElement; } // 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.0160.00616.38
8.3.50.0120.00716.40
8.3.40.0070.00718.65
8.3.30.0070.00718.71
8.3.20.0040.00418.77
8.3.10.0040.00418.60
8.3.00.0000.00819.26
8.2.180.0150.00018.16
8.2.170.0090.00622.96
8.2.160.0150.00018.91
8.2.150.0050.00324.18
8.2.140.0080.00424.66
8.2.130.0020.00526.16
8.2.120.0040.00419.54
8.2.110.0090.00022.20
8.2.100.0060.00617.91
8.2.90.0050.00317.75
8.2.80.0030.00618.76
8.2.70.0000.00817.75
8.2.60.0050.00317.75
8.2.50.0040.00418.02
8.2.40.0040.00419.35
8.2.30.0000.00917.75
8.2.20.0080.00317.68
8.2.10.0080.00019.48
8.2.00.0070.00317.61
8.1.280.0140.00025.92
8.1.270.0000.00723.99
8.1.260.0040.00426.35
8.1.250.0030.00628.09
8.1.240.0030.00623.68
8.1.230.0070.00418.97
8.1.220.0050.00317.74
8.1.210.0080.00018.77
8.1.200.0040.00417.35
8.1.190.0050.00317.11
8.1.180.0040.00418.10
8.1.170.0000.00817.62
8.1.160.0040.00418.91
8.1.150.0040.00418.54
8.1.140.0000.00817.45
8.1.130.0000.00817.43
8.1.120.0000.00717.39
8.1.110.0020.00517.36
8.1.100.0030.00517.46
8.1.90.0000.00717.34
8.1.80.0000.00717.49
8.1.70.0070.00017.42
8.1.60.0000.00817.59
8.1.50.0000.00817.36
8.1.40.0000.00817.38
8.1.30.0030.00817.54
8.1.20.0030.00617.53
8.1.10.0020.00517.41
8.1.00.0090.00017.45
8.0.300.0070.00018.77
8.0.290.0000.00716.63
8.0.280.0030.00318.48
8.0.270.0070.00017.17
8.0.260.0030.00316.69
8.0.250.0090.00017.00
8.0.240.0030.00516.84
8.0.230.0040.00416.84
8.0.220.0050.00516.79
8.0.210.0000.00716.75
8.0.200.0070.00016.77
8.0.190.0060.00316.92
8.0.180.0020.00516.86
8.0.170.0030.00616.80
8.0.160.0070.00016.80
8.0.150.0040.00416.81
8.0.140.0040.00416.86
8.0.130.0050.00013.36
8.0.120.0080.00016.85
8.0.110.0050.00316.79
8.0.100.0040.00416.99
8.0.90.0070.00016.86
8.0.80.0040.01116.86
8.0.70.0040.00416.79
8.0.60.0070.00016.91
8.0.50.0000.00816.82
8.0.30.0090.00917.00
8.0.20.0080.01017.01
8.0.10.0070.00017.02
8.0.00.0090.01116.83
7.4.330.0060.00013.00
7.4.320.0000.00816.51
7.4.300.0000.00716.61
7.4.290.0000.00716.51
7.4.280.0040.00616.35
7.4.270.0030.00316.57
7.4.260.0060.00013.23
7.4.250.0040.00416.57
7.4.240.0000.00816.51
7.4.230.0040.00416.50
7.4.220.0130.00616.55
7.4.210.0070.01416.49
7.4.200.0040.00416.49
7.4.190.0050.00316.66
7.4.160.0050.01116.70
7.4.150.0170.00016.34
7.4.140.0130.00617.86
7.4.130.0120.00616.45
7.4.120.0070.01416.47
7.4.110.0090.00916.54
7.4.100.0060.01316.41
7.4.90.0040.01516.24
7.4.80.0110.00819.39
7.4.70.0070.01016.40
7.4.60.0090.00916.46
7.4.50.0080.00016.33
7.4.40.0000.02016.40
7.4.30.0070.01016.53
7.4.00.0030.01414.79
7.3.330.0030.00313.18
7.3.320.0030.00313.35
7.3.310.0070.00016.41
7.3.300.0030.00316.20
7.3.290.0110.00516.35
7.3.280.0040.01816.25
7.3.270.0030.01316.43
7.3.260.0090.00916.54
7.3.240.0120.00416.42
7.3.230.0100.00716.54
7.3.210.0090.00916.34
7.3.200.0120.00416.50
7.3.190.0070.01516.40
7.3.180.0070.01016.61
7.3.170.0100.00616.46
7.3.160.0120.00516.56
7.3.120.0070.01015.09
7.2.330.0100.00716.72
7.2.320.0000.01716.55
7.2.310.0150.00916.61
7.2.300.0060.00916.76
7.2.290.0070.01016.79
7.2.60.0030.01317.03
7.2.00.0040.01119.23
7.1.200.0050.00515.86
7.1.70.0070.00417.04
7.1.60.0070.01319.21
7.1.50.0270.00517.14
7.1.00.0030.03722.40
7.0.200.0080.00816.47
7.0.140.0100.06722.14
7.0.120.0000.07322.16
7.0.60.0070.08720.04
7.0.50.0000.04717.95
7.0.40.0130.07320.24
7.0.30.0400.07320.09
7.0.20.0200.06020.19
7.0.10.0370.07320.07
7.0.00.0030.05320.18
5.6.280.0000.07720.77
5.6.210.0200.06320.66
5.6.200.0100.08018.22
5.6.190.0070.08320.59
5.6.180.0300.04720.61
5.6.170.0400.06320.50
5.6.160.0030.04020.58
5.6.150.0030.04018.19
5.6.140.0070.05318.15
5.6.130.0000.04318.18
5.6.120.0030.05320.99
5.6.110.0170.07321.01
5.6.100.0200.07020.89
5.6.90.0100.08021.13
5.6.80.0070.03720.40
5.6.70.0300.07320.43
5.5.350.0200.07720.43
5.5.340.0030.04018.05
5.5.330.0130.08720.47
5.5.320.0030.08020.30
5.5.310.0270.06320.25
5.5.300.0070.07017.92
5.5.290.0000.09017.98
5.5.280.0000.07020.86
5.5.270.0100.05320.90
5.5.260.0130.08020.77
5.5.250.0030.05720.71
5.5.240.0070.07720.27
5.4.450.0130.07319.54
5.4.440.0030.08319.44
5.4.430.0100.08019.19
5.4.420.0100.07319.56
5.4.410.0100.06319.17
5.4.400.0030.04019.16
5.4.390.0030.04018.92
5.4.380.0000.06719.00
5.4.370.0030.08019.15
5.4.360.0100.07319.25
5.4.350.0000.05019.16
5.4.340.0130.06019.16
5.4.320.0130.03319.16
5.4.310.0000.04319.17
5.4.300.0070.05019.23
5.4.290.0000.05019.00
5.4.280.0030.04718.85
5.4.270.0300.05319.15
5.4.260.0070.05319.23
5.4.250.0030.07718.95
5.4.240.0070.07718.85
5.4.230.0070.07319.19
5.4.220.0100.07719.09
5.4.210.0070.04318.84
5.4.200.0100.07318.87
5.4.190.0070.07719.14
5.4.180.0170.06318.86
5.4.170.0100.07319.19
5.4.160.0070.04319.22
5.4.150.0070.05319.07
5.4.140.0070.04316.46
5.4.130.0100.07016.34
5.4.120.0070.06316.37
5.4.110.0070.07316.39
5.4.100.0100.04716.38
5.4.90.0000.07316.30
5.4.80.0030.06316.28
5.4.70.0130.06716.41
5.4.60.0070.04316.39
5.4.50.0030.07316.34
5.4.40.0130.06016.43
5.4.30.0000.05716.27
5.4.20.0000.05316.34
5.4.10.0070.07716.34
5.4.00.0100.07015.95
5.3.290.0100.03714.67
5.3.280.0000.08014.62
5.3.270.0100.06314.61
5.3.260.0100.04314.63
5.3.250.0070.07014.49
5.3.240.0100.06314.61
5.3.230.0030.05014.60
5.3.220.0070.05014.62
5.3.210.0200.06014.60
5.3.200.0170.07014.59
5.3.190.0030.05714.63
5.3.180.0100.07314.59
5.3.170.0130.06314.58
5.3.160.0070.04014.72
5.3.150.0070.05014.58
5.3.140.0030.05014.58
5.3.130.0030.05014.46
5.3.120.0030.08014.57
5.3.110.0070.07714.54
5.3.100.0000.07314.09
5.3.90.0100.07314.08
5.3.80.0070.06014.07
5.3.70.0100.04714.17
5.3.60.0030.07313.89
5.3.50.0030.03714.00
5.3.40.0130.02714.00
5.3.30.0070.03013.83
5.3.20.0000.03713.69
5.3.10.0000.03713.70
5.3.00.0000.03713.71
5.2.170.0100.05011.15
5.2.160.0000.03011.20
5.2.150.0000.03311.20
5.2.140.0030.03311.07
5.2.130.0100.02011.15
5.2.120.0000.03311.15
5.2.110.0000.03011.01
5.2.100.0030.03011.11
5.2.90.0000.03011.25
5.2.80.0100.02311.04
5.2.70.0000.03011.25
5.2.60.0070.02311.11
5.2.50.0000.03011.16
5.2.40.0100.02311.16
5.2.30.0030.03311.01
5.2.20.0030.02710.93
5.2.10.0070.03010.86
5.2.00.0000.03010.89
5.1.60.0000.0239.91
5.1.50.0030.0239.97
5.1.40.0000.0239.95
5.1.30.0000.02710.41
5.1.20.0030.02310.41
5.1.10.0000.02710.04
5.1.00.0030.02310.11
5.0.50.0000.0208.52
5.0.40.0000.0238.36
5.0.30.0000.0308.38
5.0.20.0000.0238.22
5.0.10.0030.0178.20
5.0.00.0030.0278.23
4.4.90.0000.0177.98
4.4.80.0030.0177.98
4.4.70.0000.0177.98
4.4.60.0030.0137.98
4.4.50.0000.0137.98
4.4.40.0070.0177.98
4.4.30.0000.0177.98
4.4.20.0000.0177.98
4.4.10.0030.0137.98
4.4.00.0000.0237.98
4.3.110.0000.0177.98
4.3.100.0000.0137.98
4.3.90.0000.0177.98
4.3.80.0000.0237.98
4.3.70.0000.0177.98
4.3.60.0000.0177.98
4.3.50.0000.0177.98
4.3.40.0000.0237.98
4.3.30.0030.0107.98
4.3.20.0000.0177.98
4.3.10.0030.0137.98
4.3.00.0000.0137.98

preferences:
54.39 ms | 400 KiB | 5 Q