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.', '"', ';'); 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.70.0130.00918.43
8.3.60.0140.00716.63
8.3.50.0050.01322.11
8.3.40.0040.01118.63
8.3.30.0070.00719.05
8.3.20.0050.00220.16
8.3.10.0050.00323.68
8.3.00.0070.00020.71
8.2.180.0040.01116.34
8.2.170.0000.01422.96
8.2.160.0070.00722.13
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0070.00026.16
8.2.120.0060.01222.27
8.2.110.0000.00922.25
8.2.100.0040.00817.97
8.2.90.0060.00319.17
8.2.80.0040.00417.97
8.2.70.0040.00817.63
8.2.60.0000.00818.04
8.2.50.0000.00818.07
8.2.40.0060.00319.94
8.2.30.0040.00418.13
8.2.20.0040.00417.69
8.2.10.0000.00717.83
8.2.00.0050.00217.75
8.1.280.0100.00725.92
8.1.270.0040.00423.96
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0030.00623.87
8.1.230.0080.00318.97
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0030.00617.13
8.1.190.0030.00517.30
8.1.180.0030.00618.10
8.1.170.0050.00318.53
8.1.160.0000.00721.86
8.1.150.0000.00718.67
8.1.140.0070.00017.37
8.1.130.0030.00317.74
8.1.120.0000.00717.38
8.1.110.0040.00417.47
8.1.100.0040.00417.36
8.1.90.0000.00817.53
8.1.80.0000.00817.53
8.1.70.0030.00317.48
8.1.60.0070.00317.55
8.1.50.0000.00817.52
8.1.40.0000.00717.54
8.1.30.0040.00417.56
8.1.20.0000.00917.68
8.1.10.0040.00417.53
8.1.00.0000.00717.41
8.0.300.0040.00418.77
8.0.290.0040.00417.05
8.0.280.0000.00818.36
8.0.270.0030.00317.20
8.0.260.0000.00616.73
8.0.250.0070.00017.00
8.0.240.0090.00016.93
8.0.230.0030.00316.91
8.0.220.0070.00016.87
8.0.210.0060.00016.83
8.0.200.0030.00316.97
8.0.190.0000.00716.93
8.0.180.0000.00716.98
8.0.170.0050.00316.93
8.0.160.0050.00216.88
8.0.150.0070.00016.76
8.0.140.0070.00016.90
8.0.130.0000.00613.30
8.0.120.0040.00416.83
8.0.110.0000.00716.85
8.0.100.0040.00416.86
8.0.90.0050.00316.80
8.0.80.0030.01216.79
8.0.70.0040.00416.96
8.0.60.0040.00416.95
8.0.50.0000.00716.83
8.0.30.0120.00917.18
8.0.20.0090.01017.40
8.0.10.0000.00716.90
8.0.00.0090.00816.64
7.4.330.0030.00315.15
7.4.320.0030.00316.61
7.4.300.0030.00316.65
7.4.290.0030.00316.46
7.4.280.0030.00316.45
7.4.270.0030.00316.50
7.4.260.0000.00716.43
7.4.250.0050.00316.56
7.4.240.0050.00216.55
7.4.230.0040.00416.62
7.4.220.0130.00616.55
7.4.210.0070.01016.45
7.4.200.0030.00316.39
7.4.190.0040.00416.68
7.4.160.0040.01116.48
7.4.150.0170.00017.40
7.4.140.0220.00917.86
7.4.130.0050.01216.53
7.4.120.0090.01116.61
7.4.110.0070.01016.73
7.4.100.0100.01016.68
7.4.90.0120.01216.59
7.4.80.0060.01116.60
7.4.70.0100.00616.45
7.4.60.0030.01316.55
7.4.50.0050.00316.64
7.4.40.0060.01222.77
7.4.30.0070.01016.43
7.4.00.0120.00314.59
7.3.330.0060.00013.33
7.3.320.0020.00213.44
7.3.310.0080.00016.42
7.3.300.0000.00716.39
7.3.290.0060.00916.29
7.3.280.0090.00716.38
7.3.270.0090.00917.40
7.3.260.0090.00916.30
7.3.250.0060.01016.50
7.3.240.0090.01016.55
7.3.230.0090.00616.43
7.3.210.0160.00016.31
7.3.200.0150.00319.39
7.3.190.0030.01316.66
7.3.180.0070.01416.66
7.3.170.0040.01216.57
7.3.160.0100.01016.59
7.3.120.0100.00714.82
7.3.10.0130.00316.64
7.3.00.0100.00016.87
7.2.330.0120.00616.68
7.2.320.0140.01216.62
7.2.310.0030.01316.60
7.2.300.0160.01116.51
7.2.290.0060.01016.59
7.2.130.0060.00916.93
7.2.120.0000.01317.07
7.2.110.0090.00616.93
7.2.100.0100.00016.70
7.2.90.0070.01016.81
7.2.80.0030.01017.01
7.2.70.0100.00317.05
7.2.60.0130.00016.77
7.2.50.0030.01016.78
7.2.40.0030.01216.96
7.2.30.0030.00616.96
7.2.20.0000.01416.98
7.2.10.0030.00716.74
7.2.00.0070.00418.31
7.1.250.0030.00615.63
7.1.100.0040.00918.45
7.1.70.0030.01316.92
7.1.60.0090.00619.27
7.1.50.0000.01116.70
7.1.00.0000.08022.43
7.0.200.0000.00716.73
7.0.140.0030.05022.01
7.0.60.0100.03719.98
7.0.50.0030.08717.99
7.0.40.0070.04320.30
7.0.30.0470.06320.19
7.0.20.0230.04720.12
7.0.10.0100.07020.30
7.0.00.0030.08320.10
5.6.280.0000.07720.91
5.6.210.0030.08020.48
5.6.200.0070.08018.12
5.6.190.0030.04320.63
5.6.180.0330.06320.34
5.6.170.0230.06720.57
5.6.160.0030.04020.46
5.6.150.0070.08318.23
5.6.140.0030.05018.18
5.6.130.0070.08718.23
5.6.120.0070.04021.02
5.6.110.0100.05321.08
5.6.100.0170.07021.11
5.6.90.0000.05721.08
5.6.80.0070.07320.54
5.5.350.0300.06720.45
5.5.340.0070.05718.04
5.5.330.0100.03320.27
5.5.320.0070.05320.27
5.5.310.0330.07020.35
5.5.300.0130.05318.08
5.5.290.0030.04318.03
5.5.280.0030.05720.80
5.5.270.0030.06020.98
5.5.260.0170.05020.76
5.5.250.0100.07720.56
5.5.240.0200.07720.29
5.4.450.0130.07719.55
5.4.440.0070.04719.31
5.4.430.0070.07019.38
5.4.420.0070.08019.38
5.4.410.0100.05719.07
5.4.400.0030.07019.20
5.4.390.0100.05019.08
5.4.380.0000.07719.08
5.4.370.0030.05019.20
5.4.360.0000.05019.13
5.4.350.0030.06718.85
5.4.340.0100.04719.24
5.4.320.0000.05019.09
5.4.310.0030.05019.20
5.4.300.0000.07019.15
5.4.290.0030.07019.14
5.4.280.0100.06019.06
5.4.270.0030.05319.31
5.4.260.0070.04319.09
5.4.250.0070.07019.14
5.4.240.0030.06019.31
5.4.230.0070.05319.22
5.4.220.0030.05019.06
5.4.210.0000.07718.97
5.4.200.0030.05719.19
5.4.190.0070.04018.98
5.4.180.0030.03719.17
5.4.170.0000.06718.88
5.4.160.0070.07019.07
5.4.150.0100.07319.19
5.4.140.0030.06016.29
5.4.130.0000.07716.41
5.4.120.0000.07716.38
5.4.110.0000.07316.45
5.4.100.0030.07316.45
5.4.90.0130.06716.27
5.4.80.0000.07016.44
5.4.70.0100.06316.25
5.4.60.0070.04716.38
5.4.50.0000.06716.48
5.4.40.0000.07316.34
5.4.30.0070.04316.32
5.4.20.0000.04016.39
5.4.10.0000.03716.16
5.4.00.0030.03315.84
5.3.290.0000.06714.73
5.3.280.0030.05714.68
5.3.270.0030.03714.61
5.3.260.0130.05014.54
5.3.250.0070.04314.61
5.3.240.0070.06014.68
5.3.230.0070.07314.57
5.3.220.0030.05314.46
5.3.210.0030.05714.48
5.3.200.0000.05314.54
5.3.190.0000.07314.72
5.3.180.0100.06014.54
5.3.170.0030.05014.46
5.3.160.0100.07314.48
5.3.150.0000.08014.64
5.3.140.0100.05714.67
5.3.130.0100.03314.55
5.3.120.0030.03714.52
5.3.110.0030.03314.65
5.3.100.0000.03714.25
5.3.90.0000.04014.18
5.3.80.0070.03314.24
5.3.70.0000.03714.02
5.3.60.0030.03013.94
5.3.50.0030.03713.85
5.3.40.0030.03014.03
5.3.30.0000.03713.80
5.3.20.0000.03313.69
5.3.10.0000.03313.63
5.3.00.0130.02713.66
5.2.170.0070.02712.05
5.2.160.0000.02712.05
5.2.150.0030.03012.05
5.2.140.0000.03012.05
5.2.130.0070.02712.05
5.2.120.0000.03712.05
5.2.110.0070.02312.05
5.2.100.0000.02712.05
5.2.90.0100.02312.05
5.2.80.0000.03012.05
5.2.70.0000.03312.05
5.2.60.0000.03012.05
5.2.50.0030.02712.05
5.2.40.0000.02712.05
5.2.30.0000.03012.05
5.2.20.0000.02712.05
5.2.10.0070.02012.05
5.2.00.0000.03012.05
5.1.60.0000.02312.05
5.1.50.0070.02012.05
5.1.40.0170.01712.05
5.1.30.0030.02312.05
5.1.20.0030.02312.05
5.1.10.0030.02312.05
5.1.00.0000.02312.05
5.0.50.0030.01712.05
5.0.40.0000.02012.05
5.0.30.0070.02312.05
5.0.20.0000.02312.05
5.0.10.0000.02012.05
5.0.00.0030.03012.05
4.4.90.0000.01312.05
4.4.80.0030.01012.05
4.4.70.0000.01712.05
4.4.60.0030.01012.05
4.4.50.0030.01012.05
4.4.40.0030.02012.05
4.4.30.0000.01312.05
4.4.20.0000.01712.05
4.4.10.0030.01312.05
4.4.00.0030.02312.05
4.3.110.0000.01312.05
4.3.100.0030.01312.05
4.3.90.0000.01312.05
4.3.80.0000.02312.05
4.3.70.0000.01312.05
4.3.60.0000.01712.05
4.3.50.0000.01712.05
4.3.40.0000.02312.05
4.3.30.0000.01712.05
4.3.20.0000.02012.05
4.3.10.0000.01312.05
4.3.00.0030.01312.05

preferences:
55.66 ms | 401 KiB | 5 Q