3v4l.org

run code in 300+ PHP versions simultaneously
<?php $result = []; function getNumsOdd(array $nums, array &$result) { foreach($nums as $key => $num) { if ($num % 2) { $result[$key] = $num; echo $num; yield; } } } $limit_documents = 2; $gen = getNumsOdd([1,3,4,5,6,7,8,9]); for($i = 0; $limit_documents >= $i && $gen->next(); ++$i); var_dump($result); /*foreach(getNumsOdd([1,3,4,5,6]) as $key => $num) { echo $key . '=>' . $num.PHP_EOL; }*/

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.0000.01718.33
8.3.50.0130.00521.91
8.3.40.0030.01018.76
8.3.30.0080.00519.09
8.3.20.0080.00020.34
8.3.10.0080.00023.51
8.3.00.0040.00421.00
8.2.180.0090.00916.50
8.2.170.0090.00622.96
8.2.160.0160.00320.52
8.2.150.0000.00824.18
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0050.00319.24
8.2.110.0000.00922.21
8.2.100.0070.00417.91
8.2.90.0030.00619.09
8.2.80.0030.00617.97
8.2.70.0050.00317.46
8.2.60.0090.00017.93
8.2.50.0050.00318.07
8.2.40.0030.00519.82
8.2.30.0030.00518.06
8.2.20.0060.00317.67
8.2.10.0050.00217.93
8.2.00.0000.00819.45
8.1.280.0090.00625.92
8.1.270.0060.00323.91
8.1.260.0000.00726.35
8.1.250.0070.00028.09
8.1.240.0100.00023.72
8.1.230.0090.00319.17
8.1.220.0060.00317.74
8.1.210.0080.00018.77
8.1.200.0030.00617.36
8.1.190.0050.00316.87
8.1.180.0050.00318.10
8.1.170.0060.00318.55
8.1.160.0000.00721.86
8.1.150.0080.00018.49
8.1.140.0070.00017.27
8.1.130.0030.00517.84
8.1.120.0080.00017.45
8.1.110.0050.00317.36
8.1.100.0040.00417.29
8.1.90.0000.00717.40
8.1.80.0040.00417.28
8.1.70.0030.00317.36
8.1.60.0030.00617.60
8.1.50.0030.00617.58
8.1.40.0040.00417.44
8.1.30.0030.00517.61
8.1.20.0040.00417.59
8.1.10.0050.00217.44
8.1.00.0070.00017.51
8.0.300.0050.00318.77
8.0.290.0030.00316.63
8.0.280.0030.00518.39
8.0.270.0050.00317.24
8.0.260.0030.00317.11
8.0.250.0000.00716.85
8.0.240.0030.00616.96
8.0.230.0070.00016.97
8.0.220.0030.00316.79
8.0.210.0070.00016.80
8.0.200.0000.00716.97
8.0.190.0030.00317.00
8.0.180.0040.00416.81
8.0.170.0040.00416.98
8.0.160.0070.00016.77
8.0.150.0040.00416.80
8.0.140.0040.00416.77
8.0.130.0050.00013.25
8.0.120.0000.00816.94
8.0.110.0050.00316.82
8.0.100.0040.00416.84
8.0.90.0040.00416.79
8.0.80.0090.00616.94
8.0.70.0050.00216.94
8.0.60.0040.00416.94
8.0.50.0040.00416.76
8.0.30.0090.01117.06
8.0.20.0100.01017.40
8.0.10.0000.00716.96
8.0.00.0090.00817.09
7.4.330.0020.00215.00
7.4.320.0000.00616.59
7.4.300.0000.00816.50
7.4.290.0070.00016.55
7.4.280.0050.00216.51
7.4.270.0000.00816.58
7.4.260.0030.00316.61
7.4.250.0000.00716.57
7.4.240.0020.00516.47
7.4.230.0000.00816.60
7.4.220.0040.01516.57
7.4.210.0120.00616.67
7.4.200.0040.00416.53
7.4.160.0050.01116.54
7.4.150.0090.00917.40
7.4.140.0090.00917.86
7.4.130.0070.01016.49
7.4.120.0080.01016.54
7.4.110.0130.00416.57
7.4.100.0030.01416.55
7.4.90.0090.00816.43
7.4.80.0110.01119.39
7.4.70.0030.01416.53
7.4.60.0070.01016.59
7.4.50.0060.00316.39
7.4.40.0070.01116.70
7.4.30.0110.00716.54
7.4.00.0080.00614.64
7.3.330.0000.00613.09
7.3.320.0050.00013.31
7.3.310.0000.00816.34
7.3.300.0030.00316.31
7.3.290.0030.01316.29
7.3.280.0070.01216.31
7.3.270.0070.01017.40
7.3.260.0070.01016.31
7.3.250.0090.00916.35
7.3.240.0080.00816.32
7.3.230.0090.00916.55
7.3.210.0120.01016.41
7.3.200.0120.00319.39
7.3.190.0070.01016.44
7.3.180.0090.00616.16
7.3.170.0080.00916.53
7.3.160.0160.00316.43
7.3.120.0030.01315.00
7.3.110.0070.00714.55
7.3.100.0060.00614.72
7.3.90.0030.00614.75
7.3.80.0080.00315.07
7.3.70.0070.01014.85
7.3.60.0040.01114.41
7.3.50.0060.00814.63
7.3.40.0090.00614.46
7.3.30.0030.00914.91
7.3.20.0030.01016.40
7.3.10.0070.00716.67
7.3.00.0060.00616.63
7.2.330.0100.00716.23
7.2.320.0100.00716.32
7.2.310.0080.01116.43
7.2.300.0090.00916.56
7.2.290.0060.01016.67
7.2.240.0070.01014.78
7.2.230.0060.00614.99
7.2.220.0040.01114.57
7.2.210.0030.00614.83
7.2.200.0090.00314.62
7.2.190.0000.01514.83
7.2.180.0060.00614.67
7.2.170.0000.01014.70
7.2.160.0070.00714.67
7.2.150.0060.00316.87
7.2.140.0070.00716.80
7.2.130.0070.01016.57
7.2.120.0060.00916.61
7.2.110.0060.00916.90
7.2.100.0100.00716.68
7.2.90.0070.00716.87
7.2.80.0030.01316.95
7.2.70.0040.00716.63
7.2.60.0070.00816.76
7.2.50.0000.01616.76
7.2.40.0080.00316.57
7.2.30.0030.01416.58
7.2.20.0000.01716.81
7.2.10.0070.01016.84
7.2.00.0030.01118.11
7.1.330.0110.00015.41
7.1.320.0030.00715.44
7.1.310.0030.01215.70
7.1.300.0000.01415.60
7.1.290.0040.00715.80
7.1.280.0040.01115.40
7.1.270.0030.01315.49
7.1.260.0060.00615.72
7.1.250.0100.00015.76
7.1.200.0030.01015.51
7.1.100.0060.00618.15
7.1.70.0000.01616.89
7.1.60.0070.01719.70
7.1.50.0110.00734.46
7.1.00.0030.07322.43
7.0.200.0000.00716.91
7.0.140.0000.05021.95
7.0.60.0030.04019.92
7.0.50.0030.04017.73
7.0.40.0070.07320.24
7.0.30.0500.06720.24
7.0.20.0270.05020.07
7.0.10.0100.07320.37
7.0.00.0070.07720.19
5.6.280.0100.08720.93
5.6.210.0070.07020.70
5.6.200.0100.07318.18
5.6.190.0070.04720.48
5.6.180.0300.07720.67
5.6.170.0230.04720.50
5.6.160.0100.06720.43
5.6.150.0100.06318.17
5.6.140.0070.08018.16
5.6.130.0070.07318.14
5.6.120.0000.04321.05
5.6.110.0030.09020.89
5.6.100.0100.08721.14
5.6.90.0030.04721.00
5.6.80.0070.07720.50
5.6.70.3770.03720.48
5.5.350.0070.03020.40
5.5.340.0030.06017.97
5.5.330.0070.04320.37
5.5.320.0370.06720.37
5.5.310.0200.08320.24
5.5.300.0070.06718.04
5.5.290.0070.04017.91
5.5.280.0000.05320.85
5.5.270.0070.06020.84
5.5.260.0000.04320.78
5.5.250.0030.08320.65
5.5.240.0000.07320.16
5.4.450.0570.04019.20
5.4.440.0500.02319.39
5.4.430.0400.04719.40
5.4.420.0430.04019.16
5.4.410.0470.04719.46
5.4.400.0270.04719.23
5.4.390.0300.05319.06
5.4.380.0100.07318.66
5.4.370.0200.05718.68
5.4.360.0130.05718.59
5.4.350.0300.06018.77
5.4.340.0230.05318.73
5.4.320.0050.03812.50
5.4.310.0070.04412.50
5.4.300.0070.03612.51
5.4.290.0070.03812.50
5.4.280.0090.03312.40
5.4.270.0070.03712.40
5.4.260.0110.03412.40
5.4.250.0050.03912.39
5.4.240.0050.03812.40
5.4.230.0060.03812.39
5.4.220.0080.03312.39
5.4.210.0080.03412.39
5.4.200.0060.03812.39
5.4.190.0050.03712.39
5.4.180.0050.03712.39
5.4.170.0050.03712.39
5.4.160.0070.03512.39
5.4.150.0060.03612.39
5.4.140.0080.03612.07
5.4.130.0090.03312.06
5.4.120.0050.03712.02
5.4.110.0030.03812.01
5.4.100.0050.03612.02
5.4.90.0050.03712.01
5.4.80.0060.03712.02
5.4.70.0050.03712.01
5.4.60.0060.03612.01
5.4.50.0060.03612.01
5.4.40.0050.03612.00
5.4.30.0060.03511.99
5.4.20.0050.03711.99
5.4.10.0040.03612.00
5.4.00.0030.03911.49
5.3.290.0070.04712.80
5.3.280.0110.03312.71
5.3.270.0040.04212.73
5.3.260.0050.04012.72
5.3.250.0070.03612.72
5.3.240.0050.03812.72
5.3.230.0060.03812.71
5.3.220.0070.03612.68
5.3.210.0080.03812.68
5.3.200.0070.03512.68
5.3.190.0040.03912.68
5.3.180.0050.03712.68
5.3.170.0060.03712.67
5.3.160.0070.03612.67
5.3.150.0050.04012.67
5.3.140.0050.03812.66
5.3.130.0060.04912.66
5.3.120.0160.04412.66
5.3.110.0110.04912.66
5.3.100.0110.04412.12
5.3.90.0110.04612.09
5.3.80.0080.04712.08
5.3.70.0110.04512.07
5.3.60.0070.04912.06
5.3.50.0070.04812.00
5.3.40.0070.04812.00
5.3.30.0080.04911.95
5.3.20.0100.04311.72
5.3.10.0070.05011.70
5.3.00.0060.04911.68
5.2.170.0050.0429.18
5.2.160.0030.0429.18
5.2.150.0070.0399.18
5.2.140.0070.0289.18
5.2.130.0040.0319.14
5.2.120.0040.0309.14
5.2.110.0030.0329.15
5.2.100.0050.0309.14
5.2.90.0040.0349.15
5.2.80.0100.0289.14
5.2.70.0050.0329.14
5.2.60.0070.0309.09
5.2.50.0060.0319.05
5.2.40.0090.0289.03
5.2.30.0040.0329.02
5.2.20.0060.0299.00
5.2.10.0060.0288.93
5.2.00.0100.0288.79
5.1.60.0050.0258.07
5.1.50.0030.0278.06
5.1.40.0040.0268.05
5.1.30.0050.0278.40
5.1.20.0050.0268.41
5.1.10.0030.0268.14
5.1.00.0050.0258.14
5.0.50.0050.0206.62
5.0.40.0040.0196.48
5.0.30.0040.0326.29
5.0.20.0020.0216.27
5.0.10.0050.0196.24
5.0.00.0030.0326.23
4.4.90.0200.0504.78
4.4.80.0100.0364.76
4.4.70.0100.0204.75
4.4.60.0040.0194.76
4.4.50.0030.0254.77
4.4.40.0110.0534.70
4.4.30.0070.0314.76
4.4.20.0090.0304.84
4.4.10.0100.0274.85
4.4.00.0050.0354.76
4.3.110.0040.0274.67
4.3.100.0140.0324.66
4.3.90.0070.0214.63
4.3.80.0040.0284.58
4.3.70.0080.0214.63
4.3.60.0030.0314.63
4.3.50.0160.0484.62
4.3.40.0030.0514.54
4.3.30.0020.0473.28
4.3.20.0090.0363.26
4.3.10.0070.0313.22
4.3.00.0030.01711.66

preferences:
47.02 ms | 401 KiB | 5 Q