3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ms = microtime(true); $array = array(); if (count($array) != 0) { foreach($array as $strings) { echo $strings; } } echo 'Time taken: ' . (microtime(true) - $ms) . ' ms<br>'."\n"; $ms = microtime(true); $array = array(); foreach($array as $strings) { echo $strings; } echo 'Time taken: ' . (microtime(true) - $ms) . ' ms<br>'."\n"; $ms = microtime(true); $array = array('String', 'Not String'); if (count($array) != 0) { foreach($array as $strings) { echo $strings; } } echo 'Time taken: ' . (microtime(true) - $ms) . ' ms<br>'."\n"; $ms = microtime(true); $array = array('String', 'Not String'); foreach($array as $strings) { echo $strings .' '; } echo 'Time taken: ' . (microtime(true) - $ms) . ' ms<br>'."\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.00.0140.00715.05
7.3.120.0040.01514.66
7.3.110.0000.01514.64
7.3.100.0000.00814.93
7.3.90.0030.01214.59
7.3.80.0120.00315.14
7.3.70.0060.00614.69
7.3.60.0040.01114.80
7.3.50.0030.01014.64
7.3.40.0070.00714.73
7.3.30.0070.01114.80
7.3.20.0080.00816.47
7.3.10.0030.00716.54
7.3.00.0080.00516.61
7.2.250.0040.01215.13
7.2.240.0030.01515.23
7.2.230.0030.01315.29
7.2.220.0000.01115.22
7.2.210.0090.00615.03
7.2.200.0070.00714.95
7.2.190.0120.00314.83
7.2.180.0040.01114.94
7.2.170.0070.00715.13
7.2.130.0070.00716.58
7.2.120.0100.00716.94
7.2.110.0060.00316.69
7.2.100.0090.00616.91
7.2.90.0040.00717.02
7.2.80.0050.00316.75
7.2.70.0030.00917.09
7.2.60.0000.01416.91
7.2.50.0060.00916.84
7.2.40.0000.01317.02
7.2.30.0070.00717.10
7.2.20.0030.01117.09
7.2.10.0120.00316.99
7.2.00.0030.01317.87
7.1.330.0080.00615.99
7.1.320.0030.01415.64
7.1.310.0030.00615.62
7.1.300.0060.01015.76
7.1.290.0030.00915.55
7.1.280.0060.00915.88
7.1.270.0030.00615.45
7.1.260.0060.00915.71
7.1.250.0050.00315.63
7.1.240.0050.00515.93
7.1.230.0040.01115.82
7.1.220.0050.00315.48
7.1.210.0070.00715.45
7.1.200.0040.00415.75
7.1.190.0070.00715.91
7.1.180.0040.01115.43
7.1.170.0000.00815.74
7.1.160.0090.00615.74
7.1.150.0040.01215.93
7.1.140.0030.01315.91
7.1.130.0060.00915.68
7.1.120.0080.00815.57
7.1.110.0090.00615.80
7.1.100.0070.00715.71
7.1.90.0070.00715.87
7.1.80.0110.00415.84
7.1.70.0000.01216.36
7.1.60.0090.00917.41
7.1.50.0030.01416.53
7.1.40.0000.01015.75
7.1.30.0030.00915.55
7.1.20.0070.00715.76
7.1.10.0000.01015.43
7.1.00.0070.04219.11
7.0.330.0080.00315.39
7.0.320.0000.00915.48
7.0.310.0030.00615.05
7.0.300.0070.01015.32
7.0.290.0030.01315.32
7.0.280.0060.00615.34
7.0.270.0130.00315.05
7.0.260.0110.00615.30
7.0.250.0030.01015.35
7.0.240.0140.00015.10
7.0.230.0070.00715.27
7.0.220.0040.01115.33
7.0.210.0070.00715.05
7.0.200.0060.00616.11
7.0.190.0110.00315.14
7.0.180.0040.00415.12
7.0.170.0030.00715.50
7.0.160.0030.00715.10
7.0.150.0060.00615.47
7.0.140.0020.04318.60
7.0.130.0030.01015.36
7.0.120.0100.00315.37
7.0.110.0040.00815.00
7.0.100.0020.04817.49
7.0.90.0020.04917.48
7.0.80.0090.02617.65
7.0.70.0120.02517.65
7.0.60.0020.04217.51
7.0.50.0090.03117.95
7.0.40.0030.04616.69
7.0.30.0070.04016.70
7.0.20.0060.04616.88
7.0.10.0100.04316.74
7.0.00.0070.04216.74
5.6.380.0100.00314.18
5.6.370.0000.01414.08
5.6.360.0080.00514.37
5.6.350.0030.00613.79
5.6.340.0060.00914.02
5.6.330.0080.00813.96
5.6.320.0120.00614.43
5.6.310.0040.00414.14
5.6.300.0060.00314.36
5.6.290.0110.00414.39
5.6.280.0020.04417.78
5.6.270.0070.01014.41
5.6.260.0040.00714.09
5.6.250.0050.04617.55
5.6.240.0050.04217.24
5.6.230.0020.03617.29
5.6.220.0070.02317.35
5.6.210.0120.04017.41
5.6.200.0050.04817.72
5.6.190.0100.04617.57
5.6.180.0070.02717.65
5.6.170.0100.04417.58
5.6.160.0080.02517.67
5.6.150.0030.04517.64
5.6.140.0100.03817.79
5.6.130.0080.04317.68
5.6.120.0050.04217.59
5.6.110.0050.03217.65
5.6.100.0030.02517.62
5.6.90.0040.02717.66
5.6.80.0080.02217.42
5.6.70.0090.02117.25
5.6.60.0030.02517.36
5.6.50.0040.03617.25
5.6.40.0120.01917.27
5.6.30.0050.02417.14
5.6.20.0080.02217.25
5.6.10.0030.02917.32
5.6.00.0030.02717.32
5.5.380.0070.04215.75
5.5.370.0070.03915.61
5.5.360.0080.04415.75
5.5.350.0120.04015.66
5.5.340.0070.04615.99
5.5.330.0060.02515.92
5.5.320.0150.02115.92
5.5.310.0100.03316.09
5.5.300.0080.04515.79
5.5.290.0100.03815.83
5.5.280.0030.04615.87
5.5.270.0130.02815.94
5.5.260.0070.02215.94
5.5.250.0070.01815.72
5.5.240.0060.02315.55
5.5.230.0030.03515.46
5.5.220.0030.02615.55
5.5.210.0020.02415.53
5.5.200.0050.02315.39
5.5.190.0090.04515.45
5.5.180.0020.02615.62
5.5.170.0020.00510.89
5.5.160.0000.02715.52
5.5.150.0050.02015.64
5.5.140.0070.04015.41
5.5.130.0100.03315.46
5.5.120.0070.02715.43
5.5.110.0030.03015.61
5.5.100.0040.02415.52
5.5.90.0030.02615.50
5.5.80.0030.02715.55
5.5.70.0030.01915.45
5.5.60.0030.02415.51
5.5.50.0030.02015.48
5.5.40.0040.03215.50
5.5.30.0030.02315.61
5.5.20.0030.04615.54
5.5.10.0080.04015.55
5.5.00.0050.02515.48
5.4.450.0070.03815.21
5.4.440.0060.04015.26
5.4.430.0060.02215.10
5.4.420.0050.02515.08
5.4.410.0000.03115.06
5.4.400.0040.02514.96
5.4.390.0070.02015.12
5.4.380.0080.02815.05
5.4.370.0010.03414.97
5.4.360.0060.02614.98
5.4.350.0070.02214.88
5.4.340.0070.03015.03
5.4.330.0030.00710.80
5.4.320.0010.02515.13
5.4.310.0110.01814.86
5.4.300.0100.03014.78
5.4.290.0030.02314.89
5.4.280.0030.02515.07
5.4.270.0050.02815.02
5.4.260.0020.02515.00
5.4.250.0070.02314.98
5.4.240.0020.02614.99
5.4.230.0050.02815.07
5.4.220.0060.03114.81
5.4.210.0080.01814.88
5.4.200.0060.02114.77
5.4.190.0060.01714.74
5.4.180.0050.04414.91
5.4.170.0070.04315.11
5.4.160.0080.02314.81
5.4.150.0020.04314.83
5.4.140.0080.03513.68
5.4.130.0060.03613.54
5.4.120.0080.03513.62
5.4.110.0060.04113.65
5.4.100.0150.03013.62
5.4.90.0090.03513.68
5.4.80.0070.04013.58
5.4.70.0030.04313.53
5.4.60.0030.04213.73
5.4.50.0070.03813.61
5.4.40.0100.03713.62
5.4.30.0100.03313.72
5.4.20.0030.03913.67
5.4.10.0050.04013.64
5.4.00.0050.03813.38
5.3.290.0040.02212.61
5.3.280.0020.02212.46
5.3.270.0050.04212.48
5.3.260.0050.04112.55
5.3.250.0040.04012.54
5.3.240.0050.03712.39
5.3.230.0020.04612.42
5.3.220.0090.03612.24
5.3.210.0050.04012.35
5.3.200.0080.03812.32
5.3.190.0070.03812.48
5.3.180.0060.03812.44
5.3.170.0070.03012.51
5.3.160.0050.04212.56
5.3.150.0080.03612.54
5.3.140.0100.03512.53
5.3.130.0080.03512.37
5.3.120.0080.03712.41
5.3.110.0030.02712.43
5.3.100.0070.04012.18
5.3.90.0070.03712.13
5.3.80.0080.03712.16
5.3.70.0080.03712.15
5.3.60.0020.03012.27
5.3.50.0020.04112.07
5.3.40.0090.03412.08
5.3.30.0110.03812.14
5.3.20.0050.04211.97
5.3.10.0090.03711.92
5.3.00.0100.03511.99
5.2.170.0080.02610.84
5.2.160.0030.03510.84
5.2.150.0080.03310.86
5.2.140.0040.03510.79
5.2.130.0050.03110.71
5.2.120.0050.03010.81
5.2.110.0060.03210.79
5.2.100.0070.02510.79
5.2.90.0050.02710.67
5.2.80.0040.03410.74
5.2.70.0050.02010.72
5.2.60.0070.02810.61
5.2.50.0020.03310.71
5.2.40.0070.03010.71
5.2.30.0050.03210.67
5.2.20.0030.03410.76
5.2.10.0040.02310.70
5.2.00.0020.03410.64
5.1.60.0030.03010.23
5.1.50.0050.02910.18
5.1.40.0050.02610.38
5.1.30.0030.03310.49
5.1.20.0060.02510.38
5.1.10.0030.02710.39
5.1.00.0030.02810.32
5.0.50.0030.0259.85
5.0.40.0050.0229.85
5.0.30.0040.0319.75
5.0.20.0020.0259.75
5.0.10.0050.0249.65
5.0.00.0050.0329.67
4.4.90.0030.0129.65
4.4.80.0020.0179.65
4.4.70.0020.0209.65
4.4.60.0000.0209.65
4.4.50.0020.0189.65
4.4.40.0030.0259.65
4.4.30.0000.0199.65
4.4.20.0030.0189.65
4.4.10.0030.0109.65
4.4.00.0030.0309.65
4.3.110.0000.0229.65
4.3.100.0070.0159.65
4.3.90.0030.0189.65
4.3.80.0000.0289.65
4.3.70.0030.0189.65
4.3.60.0030.0189.65
4.3.50.0050.0179.65
4.3.40.0020.0289.65
4.3.30.0030.0209.65
4.3.20.0020.0229.65
4.3.10.0000.0209.65
4.3.00.0020.0189.65

preferences:
39.57 ms | 401 KiB | 5 Q