3v4l.org

run code in 300+ PHP versions simultaneously
<?php function generate_csv_data($data,$use_key=false,$delm=',') { $output = NULL; if(is_array($data)) { if($use_key == false) { if(isset($data[0]) && is_array($data[0])) { foreach($data as $key) { $output .= implode($delm,$key); $output .= "\n"; } } else { $output .= implode("$delm", $data)."\n"; } } else { foreach($data as $key => $value) { $output .= "$key{$delm}$value\n"; } } } else { $output = $data; } if(empty($output)) { trigger_error('OUTPUT WAS EMPTY!', E_USER_ERROR); return false; } return $output; } $data = array('this','is some', 'csv "stuff", you know.'); var_dump(generate_csv_data($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.0120.00918.29
8.3.50.0120.00721.14
8.3.40.0120.00318.84
8.3.30.0060.00918.85
8.3.20.0090.00018.86
8.3.10.0080.00021.05
8.3.00.0040.00423.61
8.2.180.0150.00416.63
8.2.170.0110.00422.96
8.2.160.0130.00020.52
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0050.00321.05
8.2.110.0090.00020.23
8.2.100.0040.00717.91
8.2.90.0050.00319.08
8.2.80.0080.00017.97
8.2.70.0060.00617.50
8.2.60.0030.00618.05
8.2.50.0030.00618.07
8.2.40.0000.00818.15
8.2.30.0070.00021.30
8.2.20.0000.00717.79
8.2.10.0060.00317.76
8.2.00.0040.00417.66
8.1.280.0070.01025.92
8.1.270.0030.00623.99
8.1.260.0070.00726.35
8.1.250.0030.00628.09
8.1.240.0150.00723.77
8.1.230.0090.00322.11
8.1.220.0060.00318.77
8.1.210.0050.00318.91
8.1.200.0040.00417.35
8.1.190.0090.00017.53
8.1.180.0000.00818.10
8.1.170.0050.00318.64
8.1.160.0040.00418.85
8.1.150.0060.00318.63
8.1.140.0040.00417.50
8.1.130.0000.00717.84
8.1.120.0000.00717.43
8.1.110.0000.00717.43
8.1.100.0040.00417.42
8.1.90.0000.00717.43
8.1.80.0030.00517.46
8.1.70.0030.00317.44
8.1.60.0000.00917.46
8.1.50.0030.00517.44
8.1.40.0080.00017.38
8.1.30.0050.00317.67
8.1.20.0040.00417.57
8.1.10.0000.00717.52
8.1.00.0040.00417.34
8.0.300.0000.00719.92
8.0.290.0040.00417.01
8.0.280.0070.00018.39
8.0.270.0000.00717.26
8.0.260.0030.00316.76
8.0.250.0000.00717.03
8.0.240.0000.00817.00
8.0.230.0070.00016.93
8.0.220.0050.00316.93
8.0.210.0030.00316.86
8.0.200.0040.00416.93
8.0.190.0090.00017.00
8.0.180.0040.00416.86
8.0.170.0050.00316.99
8.0.160.0000.00716.87
8.0.150.0070.00016.91
8.0.140.0040.00416.98
8.0.130.0060.00013.34
8.0.120.0000.00816.92
8.0.110.0040.00416.83
8.0.100.0050.00317.07
8.0.90.0040.00416.79
8.0.80.0090.00617.02
8.0.70.0040.00416.94
8.0.60.0000.00816.89
8.0.50.0000.00716.96
8.0.30.0140.00517.00
8.0.20.0120.00717.40
8.0.10.0040.00417.01
8.0.00.0120.00616.76
7.4.330.0030.00314.65
7.4.320.0030.00616.56
7.4.300.0030.00316.52
7.4.290.0050.00216.40
7.4.280.0030.00516.52
7.4.270.0000.00716.48
7.4.260.0030.00313.31
7.4.250.0080.00016.47
7.4.240.0000.00816.62
7.4.230.0030.00316.63
7.4.220.0080.01116.52
7.4.210.0060.00816.58
7.4.200.0040.00416.58
7.4.190.0030.00616.60
7.4.160.0060.01216.50
7.4.150.0080.01117.40
7.4.140.0070.01217.86
7.4.130.0100.00716.57
7.4.120.0110.00716.66
7.4.110.0110.00616.44
7.4.100.0100.01116.59
7.4.90.0140.00416.41
7.4.80.0140.00319.39
7.4.70.0130.00316.50
7.4.60.0130.00316.57
7.4.50.0070.00016.50
7.4.40.0000.01022.77
7.4.30.0080.00816.58
7.4.00.0090.00715.01
7.3.330.0030.00313.53
7.3.320.0050.00013.32
7.3.310.0000.00716.39
7.3.300.0070.00016.30
7.3.290.0100.01016.40
7.3.280.0080.00716.42
7.3.270.0030.01317.40
7.3.260.0150.00518.24
7.3.250.0130.00716.53
7.3.240.0070.01316.65
7.3.230.0070.01016.39
7.3.210.0090.00916.44
7.3.200.0080.01219.39
7.3.190.0090.01516.62
7.3.180.0090.00616.46
7.3.170.0090.01216.36
7.3.160.0160.00016.38
7.3.120.0080.00714.92
7.3.110.0130.00714.81
7.3.100.0000.01515.02
7.3.90.0080.00414.89
7.3.80.0000.00915.13
7.3.70.0070.00714.66
7.3.60.0000.01414.95
7.3.50.0110.00414.82
7.3.40.0040.01114.68
7.3.30.0040.01114.60
7.3.20.0000.01016.73
7.3.10.0040.00916.63
7.3.00.0120.00516.57
7.2.330.0060.01216.54
7.2.320.0100.00716.54
7.2.310.0090.00916.49
7.2.300.0040.01216.43
7.2.290.0090.00616.87
7.2.250.0100.01015.00
7.2.240.0030.01815.06
7.2.230.0030.01315.06
7.2.220.0110.00015.05
7.2.210.0100.00315.04
7.2.200.0030.01215.11
7.2.190.0060.00915.09
7.2.180.0100.00715.18
7.2.170.0110.00414.97
7.2.130.0000.00916.37
7.2.120.0070.00716.87
7.2.110.0080.00416.63
7.2.100.0000.01116.69
7.2.90.0030.00816.68
7.2.80.0060.00616.63
7.2.70.0000.01216.69
7.2.60.0000.01216.82
7.2.50.0040.01117.01
7.2.40.0030.01116.53
7.2.30.0050.00816.64
7.2.20.0110.00416.47
7.2.10.0040.00717.00
7.2.00.0060.00518.23
7.1.330.0070.00715.77
7.1.320.0110.00015.68
7.1.310.0000.01315.86
7.1.300.0000.01015.84
7.1.290.0090.00015.80
7.1.280.0070.00715.61
7.1.270.0000.01515.89
7.1.260.0070.00315.54
7.1.250.0060.00315.55
7.1.200.0110.00415.87
7.1.100.0040.00717.94
7.1.70.0030.00517.09
7.1.60.0060.01919.40
7.1.50.0150.00616.85
7.1.00.0030.03722.42
7.0.200.0000.00716.68
7.0.140.0070.07321.95
7.0.60.0100.07320.11
7.0.50.0070.07717.93
7.0.40.0030.05020.40
7.0.30.0370.08020.23
7.0.20.0300.08020.33
7.0.10.0170.03320.10
7.0.00.0130.04320.07
5.6.210.0100.06720.54
5.6.200.0030.05718.29
5.6.190.0100.06720.61
5.6.180.0370.07720.64
5.6.170.0270.07020.52
5.6.160.0070.07720.48
5.6.150.0000.06018.19
5.6.140.0070.03718.21
5.6.130.0070.03718.18
5.6.120.0100.04321.15
5.6.110.0100.05021.02
5.6.100.0100.07021.03
5.6.90.0100.06021.04
5.6.80.0030.03720.36
5.6.70.4570.04020.37
5.5.350.0100.07020.31
5.5.340.0070.08317.96
5.5.330.0070.08020.48
5.5.320.0130.08020.32
5.5.310.0230.08020.34
5.5.300.0030.05717.97
5.5.290.0100.08017.98
5.5.280.0030.07020.94
5.5.270.0030.04720.80
5.5.260.0170.03720.98
5.5.250.0100.08320.69
5.5.240.0070.07020.08
5.4.450.0030.04319.20
5.4.440.1570.04319.12
5.4.430.1300.03319.15
5.4.420.1430.04319.51
5.4.410.1500.04019.44
5.4.400.1770.03318.95
5.4.390.1700.04319.17
5.4.380.1530.03719.24
5.4.370.2000.04319.13
5.4.360.1900.03319.16
5.4.350.2000.04019.09
5.4.340.2230.05018.96
5.4.320.1830.03718.84
5.4.310.1870.03019.09
5.4.300.1770.03318.87
5.4.290.1770.03719.05
5.4.280.1800.04319.14
5.4.270.1700.02719.13
5.4.260.1830.03319.14
5.4.250.1570.04019.19
5.4.240.0000.04019.03
5.4.230.0030.08018.94
5.4.220.0070.07718.82
5.4.210.1230.04319.21
5.4.200.1830.03019.07
5.4.190.2070.04719.15
5.4.180.2130.04318.97
5.4.170.1870.04718.96
5.4.160.2000.04019.05
5.4.150.2100.04319.04
5.4.140.1930.04016.41
5.4.130.1830.03016.33
5.4.120.1970.03016.51
5.4.110.2030.04716.41
5.4.100.2030.04016.55
5.4.90.1800.03316.51
5.4.80.1830.03016.54
5.4.70.2130.03716.43
5.4.60.2130.04016.54
5.4.50.2130.03716.48
5.4.40.2070.04016.42
5.4.30.2030.04016.41
5.4.20.2070.03316.55
5.4.10.1870.04016.34
5.4.00.2000.03315.75
5.3.290.2170.04014.63
5.3.280.2200.03314.58
5.3.270.2130.05314.75
5.3.260.2100.04014.83
5.3.250.1770.04714.73
5.3.240.2070.04714.51
5.3.230.2070.04314.75
5.3.220.2100.03714.49
5.3.210.2070.04314.48
5.3.200.1970.04014.79
5.3.190.1900.03714.45
5.3.180.1800.04014.59
5.3.170.1930.03714.65
5.3.160.0570.04014.46
5.3.150.0130.03014.64
5.3.140.0070.07314.63
5.3.130.0400.04314.46
5.3.120.1800.04714.60
5.3.110.1830.04014.50
5.3.100.2200.04013.95
5.3.90.2130.04314.07
5.3.80.1800.04013.92
5.3.70.1970.03713.92
5.3.60.1830.03713.93
5.3.50.2170.03713.88
5.3.40.1970.03314.00
5.3.30.1870.03314.01
5.3.20.1830.03713.61
5.3.10.2170.03013.56
5.3.00.1830.04313.87
5.2.170.1970.03311.16
5.2.160.1800.03711.30
5.2.150.1770.02711.38
5.2.140.1770.03711.13
5.2.130.1700.02711.26
5.2.120.1670.03011.34
5.2.110.1530.02011.03
5.2.100.1730.04011.16
5.2.90.1800.03311.11
5.2.80.1730.03311.18
5.2.70.1700.03311.01
5.2.60.1630.03310.98
5.2.50.1700.03710.93
5.2.40.1400.03310.92
5.2.30.1400.03710.88
5.2.20.1430.03710.93
5.2.10.1470.03710.81
5.2.00.1500.03310.61
5.1.60.1400.02710.15
5.1.50.1430.0309.90
5.1.40.1400.02710.11
5.1.30.1430.03710.34
5.1.20.1400.02010.37
5.1.10.1470.03010.21
5.1.00.1430.02710.02
5.0.50.0770.0338.54
5.0.40.0600.0208.42
5.0.30.0770.0308.39
5.0.20.0830.0238.12
5.0.10.0700.0238.09
5.0.00.0800.0438.15
4.4.90.0730.0207.70
4.4.80.0570.0177.70
4.4.70.0670.0207.70
4.4.60.0670.0177.70
4.4.50.0670.0207.70
4.4.40.0670.0277.70
4.4.30.0770.0177.70
4.4.20.0700.0177.70
4.4.10.0670.0207.70
4.4.00.0730.0407.70
4.3.110.0700.0207.70
4.3.100.0730.0237.70
4.3.90.0570.0137.70
4.3.80.0000.0537.70
4.3.70.0000.0377.70
4.3.60.0030.0177.70
4.3.50.0100.0277.70
4.3.40.0030.0237.70
4.3.30.0000.0277.70
4.3.20.0070.0207.70
4.3.10.0000.0177.70
4.3.00.0000.0177.70

preferences:
39.59 ms | 401 KiB | 5 Q