3v4l.org

run code in 300+ PHP versions simultaneously
<?php $iter = 100; $array = range(0, $iter); $function = function($val, $key) {}; $t = microtime(true); for($i = 0; $i < $iter; $i++) { foreach($array as $key => $val) { $function($val, $key); } } echo 'foreach: '.(microtime(true) - $t); $t = microtime(true); for($i = 0; $i < $iter; $i++) { array_walk($array, $function); } echo ', array_walk: '.(microtime(true) - $t); $t = microtime(true); for($i = 0; $i < $iter; $i++) { array_map($function, $array, array_keys($array)); } echo ', array_map: '.(microtime(true) - $t).'\n';

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)
7.4.10.0070.01415.11
7.4.00.0030.01415.05
7.3.130.0140.00714.71
7.3.120.0110.00914.91
7.3.110.0060.01215.02
7.3.100.0050.01114.88
7.3.90.0030.01214.98
7.3.80.0030.01314.84
7.3.70.0020.01114.67
7.3.60.0100.00914.75
7.3.50.0020.01714.89
7.3.40.0080.00914.84
7.3.30.0050.01214.71
7.3.20.0080.00816.61
7.3.10.0080.00616.54
7.3.00.0050.01216.29
7.2.260.0070.01314.89
7.2.250.0120.00715.03
7.2.240.0070.01414.90
7.2.230.0020.01615.01
7.2.220.0060.00915.14
7.2.210.0040.01114.94
7.2.200.0030.01214.98
7.2.190.0080.00814.97
7.2.180.0030.01214.88
7.2.170.0030.01915.15
7.2.160.0000.01014.99
7.2.150.0030.01316.56
7.2.140.0060.00617.00
7.2.130.0070.01116.81
7.2.120.0030.01417.06
7.2.110.0090.00916.86
7.2.100.0000.01517.06
7.2.90.0130.00716.99
7.2.80.0100.00717.00
7.2.70.0000.01317.07
7.2.60.0070.01017.00
7.2.50.0060.01416.85
7.2.40.0030.02017.11
7.2.30.0030.01216.89
7.2.20.0040.01417.03
7.2.10.0100.01016.81
7.2.00.0030.01218.24
7.1.330.0100.00815.58
7.1.320.0030.01415.62
7.1.310.0090.00815.88
7.1.300.0070.00715.74
7.1.290.0000.01915.80
7.1.280.0100.01015.76
7.1.270.0050.01215.73
7.1.260.0000.01415.75
7.1.250.0000.01515.76
7.1.240.0070.01315.62
7.1.230.0030.01315.80
7.1.220.0060.00915.77
7.1.210.0080.01115.89
7.1.200.0060.01215.73
7.1.190.0080.01215.86
7.1.180.0110.00715.80
7.1.170.0030.01015.92
7.1.160.0000.01415.83
7.1.150.0000.01915.98
7.1.140.0000.01715.82
7.1.130.0060.01315.82
7.1.120.0070.00415.93
7.1.110.0070.01015.75
7.1.100.0040.01115.71
7.1.90.0070.01115.83
7.1.80.0030.01015.63
7.1.70.0060.00716.45
7.1.60.0090.01417.67
7.1.50.0120.00716.38
7.1.40.0100.00715.86
7.1.30.0100.00715.31
7.1.20.0070.01015.61
7.1.10.0070.01015.76
7.1.00.0080.04119.14
7.0.330.0030.01615.23
7.0.320.0060.00615.48
7.0.310.0030.01615.38
7.0.300.0060.00915.33
7.0.290.0130.00915.36
7.0.280.0130.00315.43
7.0.270.0150.00315.44
7.0.260.0030.01315.30
7.0.250.0060.00915.16
7.0.240.0040.01115.30
7.0.230.0070.01015.36
7.0.220.0030.01015.16
7.0.210.0080.00815.40
7.0.200.0030.01116.14
7.0.190.0000.01515.45
7.0.180.0070.00715.35
7.0.170.0030.00715.46
7.0.160.0030.01015.45
7.0.150.0070.01015.26
7.0.140.0080.03818.71
7.0.130.0040.00815.62
7.0.120.0050.04418.65
7.0.110.0040.03718.62
7.0.100.0020.03918.64
7.0.90.0050.04318.65
7.0.80.0060.04118.76
7.0.70.0030.04318.87
7.0.60.0020.04618.71
7.0.50.0020.04218.79
7.0.40.0020.04417.92
7.0.30.0040.03717.83
7.0.20.0030.04217.77
7.0.10.0040.04217.80
7.0.00.0070.03417.84
5.6.400.0030.01914.52
5.6.390.0060.01614.57
5.6.380.0060.01614.37
5.6.370.0030.01714.40
5.6.360.0130.01314.36
5.6.350.0000.02414.29
5.6.340.0130.00914.34
5.6.330.0070.01414.50
5.6.320.0060.01614.61
5.6.310.0030.01614.41
5.6.300.0070.01414.43
5.6.290.0030.02414.73
5.6.280.0020.05417.83
5.6.270.0030.02014.51
5.6.260.0050.05017.67
5.6.250.0050.05017.82
5.6.240.0020.04817.57
5.6.230.0040.05317.60
5.6.220.0030.05117.57
5.6.210.0050.04317.63
5.6.200.0020.05317.60
5.6.190.0030.05317.62
5.6.180.0070.04717.71
5.6.170.0040.04917.65
5.6.160.0050.05017.64
5.6.150.0050.05117.51
5.6.140.0040.05117.64
5.6.130.0020.05117.86
5.6.120.0040.04817.58
5.6.110.0020.05317.70
5.6.100.0070.04717.73
5.6.90.0020.03917.75
5.6.80.0060.04517.20
5.6.70.0080.04517.27
5.6.60.0030.03917.37
5.6.50.0050.04717.42
5.6.40.0050.04617.34
5.6.30.0070.04517.34
5.6.20.0050.02917.33
5.6.10.0050.02517.42
5.6.00.0070.04217.30
5.5.380.0050.04816.10
5.5.370.0000.05316.00
5.5.360.0040.04815.95
5.5.350.0050.04616.06
5.5.340.0030.04816.23
5.5.330.0000.05316.38
5.5.320.0020.05116.02
5.5.310.0060.03916.27
5.5.300.0030.04916.29
5.5.290.0030.04716.28
5.5.280.0030.05216.29
5.5.270.0070.04716.21
5.5.260.0030.05116.21
5.5.250.0050.04315.84
5.5.240.0070.04615.72
5.5.230.0050.04215.96
5.5.220.0030.03215.86
5.5.210.0020.02815.96
5.5.200.0020.04615.77
5.5.190.0040.04815.85
5.5.180.0070.04215.98
5.5.170.0060.00914.16
5.5.160.0070.04315.73
5.5.150.0050.04215.90
5.5.140.0060.03415.88
5.5.130.0020.03015.77
5.5.120.0030.02515.72
5.5.110.0050.03615.97
5.5.100.0070.04215.66
5.5.90.0020.03615.74
5.5.80.0060.04615.67
5.5.70.0000.05215.84
5.5.60.0070.04315.73
5.5.50.0040.04215.79
5.5.40.0060.04515.87
5.5.30.0020.03315.73
5.5.20.0050.04615.71
5.5.10.0040.02615.86
5.5.00.0040.04815.76
5.4.450.0000.04615.42
5.4.440.0050.04815.28
5.4.430.0030.04615.31
5.4.420.0020.04715.17
5.4.410.0030.04115.13
5.4.400.0020.04715.31
5.4.390.0020.04115.09
5.4.380.0030.03815.10
5.4.370.0030.04715.09
5.4.360.0020.04715.05
5.4.350.0030.04815.09
5.4.340.0020.02815.08
5.4.330.0060.01310.84
5.4.320.0050.04515.06
5.4.310.0030.03915.06
5.4.300.0050.04714.96
5.4.290.0030.02715.05
5.4.280.0040.02815.09
5.4.270.0020.03514.92
5.4.260.0030.04415.10
5.4.250.0020.04615.15
5.4.240.0020.04015.03
5.4.230.0040.04315.03
5.4.220.0030.04614.86
5.4.210.0050.04515.17
5.4.200.0000.03915.05
5.4.190.0030.03815.12
5.4.180.0030.02715.03
5.4.170.0030.02615.22
5.4.160.0080.03815.05
5.4.150.0070.04315.02
5.4.140.0050.04813.85
5.4.130.0090.03713.71
5.4.120.0030.04413.84
5.4.110.0030.04313.88
5.4.100.0050.04513.81
5.4.90.0020.04313.82
5.4.80.0030.03613.84
5.4.70.0000.04613.53
5.4.60.0000.04813.84
5.4.50.0030.03913.88
5.4.40.0030.03213.83
5.4.30.0030.02613.88
5.4.20.0030.03313.82
5.4.10.0040.04413.79
5.4.00.0020.04213.40
5.3.290.0050.04712.65
5.3.280.0050.04612.70
5.3.270.0030.02912.67
5.3.260.0050.04412.54
5.3.250.0050.04512.76
5.3.240.0020.05112.60
5.3.230.0060.04212.62
5.3.220.0050.04312.52
5.3.210.0030.04712.52
5.3.200.0030.04712.46
5.3.190.0030.04512.64
5.3.180.0020.04812.56
5.3.170.0020.04612.60
5.3.160.0020.04612.65
5.3.150.0000.03512.63
5.3.140.0000.03912.51
5.3.130.0030.02612.44
5.3.120.0050.04912.62
5.3.110.0020.05012.68
5.3.100.0000.04512.27
5.3.90.0000.04012.32
5.3.80.0020.04312.25
5.3.70.0030.04512.32
5.3.60.0020.04612.41
5.3.50.0050.04812.31
5.3.40.0000.05112.29
5.3.30.0050.03912.28
5.3.20.0030.04512.15
5.3.10.0030.04411.89
5.3.00.0020.04411.98
5.2.170.0000.05711.09
5.2.160.0100.04711.03
5.2.150.0030.04711.08
5.2.140.0070.04011.15
5.2.130.0070.05011.12
5.2.120.0000.04010.98
5.2.110.0030.05011.11
5.2.100.0030.05310.89
5.2.90.0000.05311.04
5.2.80.0000.05711.00
5.2.70.0000.04711.04
5.2.60.0000.05310.99
5.2.50.0030.04710.94
5.2.40.0100.03310.89
5.2.30.0030.04711.04
5.2.20.0030.05011.04
5.2.10.0000.04310.87
5.2.00.0030.03310.64
5.1.60.0000.03010.05
5.1.50.0030.02710.05
5.1.40.0030.0309.87
5.1.30.0000.05010.33
5.1.20.0000.04710.48
5.1.10.0000.0409.98
5.1.00.0030.04710.21
5.0.50.0030.0309.79
5.0.40.0130.0279.79
5.0.30.0000.0609.79
5.0.20.0000.0379.79
5.0.10.0000.0409.79
5.0.00.0030.0539.79
4.4.90.0030.0279.79
4.4.80.0000.0309.79
4.4.70.0000.0309.79
4.4.60.0030.0279.79
4.4.50.0000.0279.79
4.4.40.0000.0479.79
4.4.30.0030.0279.79
4.4.20.0030.0279.79
4.4.10.0030.0239.79
4.4.00.0030.0439.79
4.3.110.0000.0339.79
4.3.100.0030.0279.79
4.3.90.0000.0279.79
4.3.80.0000.0339.79
4.3.70.0070.0239.79
4.3.60.0000.0209.79
4.3.50.0000.0339.79
4.3.40.0030.0379.79
4.3.30.0000.0209.79
4.3.20.0000.0179.79
4.3.10.0000.0139.79
4.3.00.0000.0209.79

preferences:
50.96 ms | 400 KiB | 5 Q