3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function flatten_array($array, $flat = array()) { foreach($array as $k=>$v){ $k = strval($k); if(!is_array($v)){ $i = 0; while(true){ $i++; $key = $k."-".strval($i); if(!isset($flat[$key])) break; } $flat[$key] = $v; }else{ $flat = flatten_array($v, $flat); } } return $flat; } // this line generates a 10x10 multi-d array $a = array_fill(0, 10, array_fill(0, 10, 0)); $flat_array = flatten_array($a); var_dump($flat_array);

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).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.2.110.0190.00016.71
7.2.100.0160.00316.53
7.2.90.0040.01216.79
7.2.80.0490.00916.27
7.2.70.1470.00716.79
7.2.60.0070.00716.88
7.2.50.0030.01416.84
7.2.40.0150.00017.09
7.2.30.0150.00316.98
7.2.20.0160.00516.90
7.2.10.0160.00817.04
7.2.00.0050.00918.20
7.1.230.0060.00615.73
7.1.220.0120.00615.52
7.1.210.0130.00315.97
7.1.200.0070.01015.79
7.1.190.0130.00715.84
7.1.180.2840.00315.85
7.1.170.0070.01115.96
7.1.160.0040.01315.71
7.1.150.0100.00815.75
7.1.140.0120.00415.55
7.1.130.0640.00315.93
7.1.120.0070.00715.73
7.1.110.0090.00915.82
7.1.100.0040.00916.79
7.1.90.0090.00915.74
7.1.80.0110.00315.73
7.1.70.0060.00616.64
7.1.60.0100.00817.68
7.1.50.0060.01616.41
7.1.40.0080.01215.79
7.1.30.0130.00816.11
7.1.20.0130.00715.84
7.1.10.0100.00615.45
7.1.00.0100.03819.12
7.0.310.0150.00015.53
7.0.300.0120.00315.39
7.0.290.0110.00615.18
7.0.280.0240.00415.36
7.0.270.0060.01015.29
7.0.260.0140.00315.45
7.0.250.0070.01115.61
7.0.240.0640.00715.46
7.0.230.0130.00315.50
7.0.220.0560.00315.15
7.0.210.0080.00815.22
7.0.200.0070.00615.87
7.0.190.0110.00315.57
7.0.180.0100.00615.38
7.0.170.0170.00015.49
7.0.160.0130.01015.38
7.0.150.0100.00315.55
7.0.140.0060.03918.75
7.0.130.0090.00915.32
7.0.120.0030.01215.32
7.0.110.0080.00815.42
7.0.100.0110.00615.27
7.0.90.0100.00715.19
7.0.80.0120.00415.64
7.0.70.0310.00615.13
7.0.60.0090.03817.63
7.0.50.0110.04216.66
7.0.40.0130.04516.98
7.0.30.0170.04516.91
7.0.20.0170.02716.83
7.0.10.0110.02916.68
7.0.00.0030.05116.77
hhvm-3.22.00.0930.16290.40
hhvm-3.21.30.0970.13690.55
hhvm-3.21.00.0700.13690.60
hhvm-3.20.20.0650.14090.19
hhvm-3.19.20.0880.11489.18
hhvm-3.18.50.0970.13488.72
hhvm-3.18.40.0630.13688.46
hhvm-3.17.30.0670.13887.54
hhvm-3.15.40.0620.11485.57
hhvm-3.13.20.0900.10396.37
hhvm-3.12.140.0750.13695.91
hhvm-3.11.10.0840.10487.88
hhvm-3.10.10.0590.10684.19
5.6.380.0150.00414.69
5.6.370.0120.00414.36
5.6.360.0120.00214.45
5.6.350.0160.00014.44
5.6.340.0040.01514.44
5.6.330.0090.00914.77
5.6.320.0130.00514.73
5.6.310.0090.00414.54
5.6.300.0130.00314.58
5.6.290.0150.00014.23
5.6.280.0080.03817.77
5.6.270.0150.00014.39
5.6.260.0150.00414.62
5.6.250.0000.01714.42
5.6.240.0150.00014.58
5.6.230.0100.00514.64
5.6.220.0150.00014.40
5.6.210.0100.04017.64
5.6.200.0160.03716.27
5.6.190.0110.02217.68
5.6.180.0190.04617.38
5.6.170.0220.02317.36
5.6.160.0070.03317.49
5.6.150.0070.02116.33
5.6.140.0110.04416.33
5.6.130.0050.02616.37
5.6.120.0120.04317.64
5.6.110.0100.02417.84
5.6.100.0140.04217.76
5.6.90.0100.04317.80
5.6.80.0080.03517.41
5.6.70.0000.01314.35
5.6.60.0040.01114.33
5.6.50.0120.00314.25
5.6.40.0060.01214.39
5.6.30.0090.00714.32
5.6.20.0130.00514.13
5.6.10.0050.00914.07
5.6.00.0130.00014.18
5.5.380.0060.00612.79
5.5.370.0080.00612.79
5.5.360.0110.00012.79
5.5.350.0170.04416.61
5.5.340.0080.02115.35
5.5.330.0070.02516.53
5.5.320.0050.03916.55
5.5.310.0190.04416.53
5.5.300.0100.03715.39
5.5.290.0080.04315.37
5.5.280.0140.03816.78
5.5.270.0070.04016.84
5.5.260.0070.02316.84
5.5.250.0080.02116.74
5.5.240.0070.01716.47
5.5.230.0100.00312.79
5.5.220.0080.00412.79
5.5.210.0030.01212.79
5.5.200.0120.00212.79
5.5.190.0160.00012.79
5.5.180.0110.00312.79
5.5.170.0060.00614.05
5.5.160.0090.00412.79
5.5.150.0090.00612.79
5.5.140.0040.00812.79
5.5.130.0040.00912.79
5.5.120.0110.00412.79
5.5.110.0110.00212.79
5.5.100.0110.00012.79
5.5.90.0080.00412.79
5.5.80.0100.00312.79
5.5.70.0080.00812.79
5.5.60.0090.00612.79
5.5.50.0070.00712.79
5.5.40.0130.00312.79
5.5.30.0070.00712.79
5.5.20.0120.00312.79
5.5.10.0040.00412.79
5.5.00.0040.00812.79
5.4.450.0170.02316.16
5.4.440.0130.02115.98
5.4.430.0160.02015.99
5.4.420.0090.02615.99
5.4.410.0140.02016.10
5.4.400.0170.03015.96
5.4.390.0190.02515.81
5.4.380.0140.02015.83
5.4.370.0140.01916.01
5.4.360.0190.02215.81
5.4.350.0130.02615.88
5.4.340.0110.02515.94
5.4.330.0040.01112.79
5.4.320.0130.02015.89
5.4.310.0110.03015.97
5.4.300.0110.02415.96
5.4.290.0180.01715.89
5.4.280.0150.02015.98
5.4.270.0150.02316.00
5.4.260.0200.02716.01
5.4.250.0130.02215.89
5.4.240.0200.02315.96
5.4.230.0110.03415.96
5.4.220.0220.01816.02
5.4.210.0160.02715.99
5.4.200.0130.03015.93
5.4.190.0100.02215.97
5.4.180.0140.03715.88
5.4.170.0080.03015.82
5.4.160.0110.02615.93
5.4.150.0180.02016.00
5.4.140.0150.02714.65
5.4.130.0180.02214.54
5.4.120.0060.02314.57
5.4.110.0150.02414.68
5.4.100.0150.02514.63
5.4.90.0080.02214.65
5.4.80.0170.01414.64
5.4.70.0150.02014.62
5.4.60.0130.01814.62
5.4.50.0120.01914.67
5.4.40.0110.02614.61
5.4.30.0160.04014.67
5.4.20.0140.01714.65
5.4.10.0150.02514.56
5.4.00.0200.01814.38
5.3.290.0160.03413.78
5.3.280.0120.03113.65
5.3.270.0140.02813.70
5.3.260.0120.02513.79
5.3.250.0130.03313.66
5.3.240.0140.02613.77
5.3.230.0100.03213.67
5.3.220.0110.02113.64
5.3.210.0120.04013.80
5.3.200.0110.02613.80
5.3.190.0170.02113.73
5.3.180.0140.03113.67
5.3.170.0080.02413.69
5.3.160.0130.02113.64
5.3.150.0180.02213.80
5.3.140.0130.03513.64
5.3.130.0100.03713.64
5.3.120.0070.03713.72
5.3.110.0180.02213.71
5.3.100.0150.03113.38
5.3.90.0130.04213.40
5.3.80.0190.03413.37
5.3.70.0130.02513.45
5.3.60.0180.03013.36
5.3.50.0120.03313.41
5.3.40.0230.01513.34
5.3.30.0140.03113.40
5.3.20.0090.02413.20
5.3.10.0140.01813.19
5.3.00.0170.02313.28
5.2.170.0120.02012.02
5.2.160.0160.03311.94
5.2.150.0120.01712.02
5.2.140.0120.02311.93
5.2.130.0090.01711.95
5.2.120.0140.01911.92
5.2.110.0120.02411.99
5.2.100.0130.03312.00
5.2.90.0060.02512.02
5.2.80.0070.01912.01
5.2.70.0100.01811.99
5.2.60.0110.01511.89
5.2.50.0100.02411.97
5.2.40.0090.03311.96
5.2.30.0150.01711.89
5.2.20.0090.01511.93
5.2.10.0120.01811.88
5.2.00.0090.01711.79
5.1.60.0050.01411.44
5.1.50.0060.02411.46
5.1.40.0050.02711.47
5.1.30.0070.03211.53
5.1.20.0440.01811.62
5.1.10.0750.01611.48
5.1.00.0720.01911.43
5.0.50.0430.01910.76
5.0.40.0440.01210.68
5.0.30.0380.02710.69
5.0.20.0430.01510.70
5.0.10.0350.01810.71
5.0.00.0370.02710.71
4.4.90.0320.01410.72
4.4.80.0280.01210.72
4.4.70.0330.01210.72
4.4.60.0370.01210.72
4.4.50.0330.01010.72
4.4.40.0410.02110.72
4.4.30.0320.01410.72
4.4.20.0200.01810.72
4.4.10.0320.00810.72
4.4.00.0320.01410.72
4.3.110.0300.01010.72
4.3.100.0030.01110.72
4.3.90.0020.01110.72
4.3.80.0020.01510.72
4.3.70.0040.00710.72
4.3.60.0050.01710.72
4.3.50.0020.01010.72
4.3.40.0000.01610.72
4.3.30.0000.01310.72
4.3.20.0090.00810.72
4.3.10.0170.01610.72
4.3.00.0150.01410.72