3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('error_reporting', -1); ini_set('display_errors', 'on'); class Foo { private static $a = ['b' => ['4', '5', '6'], 'c' => ['1', '2', '3']]; public function generator() { foreach (self::$a as $k => $v) { yield from $this->getType($k); } } public function getType(){ foreach (self::$a[$type] as $t) { yield $t; } self::$a[$type] = []; } } $foo = new Foo; $generator = $foo->generator(); if ($generator->valid()) { foreach($generator as $i) { echo $i; } } else { echo 'Nothing'; } $generator = $foo->generator(); if ($generator->valid()) { foreach($generator as $i) { echo $i; } } else { echo 'Nothing'; }

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.0060.00918.43
8.3.50.0070.00716.63
8.3.40.0120.00318.67
8.3.30.0150.00018.79
8.3.20.0040.00419.10
8.3.10.0050.00221.90
8.3.00.0080.00019.47
8.2.180.0140.00316.75
8.2.170.0070.00722.96
8.2.160.0100.00320.36
8.2.150.0050.00324.18
8.2.140.0050.00324.66
8.2.130.0070.00020.36
8.2.120.0040.00426.35
8.2.110.0080.00320.25
8.2.100.0110.00017.97
8.2.90.0040.00419.18
8.2.80.0050.00318.03
8.2.70.0030.00717.63
8.2.60.0000.00818.05
8.2.50.0000.00818.10
8.2.40.0000.00822.32
8.2.30.0000.00921.16
8.2.20.0040.00418.14
8.2.10.0070.00018.14
8.2.00.0050.00218.19
8.1.280.0110.00425.92
8.1.270.0030.00622.07
8.1.260.0000.00826.35
8.1.250.0000.00728.09
8.1.240.0040.00422.23
8.1.230.0090.00317.52
8.1.220.0050.00317.74
8.1.210.0030.00518.77
8.1.200.0030.00617.35
8.1.190.0040.00417.47
8.1.180.0000.00818.10
8.1.170.0030.00618.64
8.1.160.0030.00319.04
8.1.150.0000.00720.62
8.1.140.0070.00419.47
8.1.130.0040.00418.81
8.1.120.0000.00717.51
8.1.110.0040.00417.49
8.1.100.0040.00417.47
8.1.90.0080.00017.52
8.1.80.0030.00717.46
8.1.70.0000.00717.53
8.1.60.0090.00017.57
8.1.50.0040.00417.44
8.1.40.0030.00917.50
8.1.30.0040.00417.66
8.1.20.0000.00717.52
8.1.10.0040.00417.62
8.1.00.0040.00417.59
8.0.300.0000.00718.77
8.0.290.0000.00716.60
8.0.280.0050.00318.50
8.0.270.0070.00017.25
8.0.260.0060.00316.91
8.0.250.0030.00317.10
8.0.240.0040.00416.90
8.0.230.0000.01017.09
8.0.220.0030.00316.86
8.0.210.0030.00316.84
8.0.200.0030.00317.05
8.0.190.0040.00416.94
8.0.180.0070.00016.99
8.0.170.0000.00716.89
8.0.160.0040.00416.81
8.0.150.0030.00516.83
8.0.140.0040.00416.92
8.0.130.0000.00513.45
8.0.120.0040.00416.84
8.0.110.0050.00217.02
8.0.100.0040.00416.87
8.0.90.0000.00716.84
8.0.80.0080.01316.94
8.0.70.0000.00717.04
8.0.60.0040.00416.86
8.0.50.0040.00416.95
8.0.30.0120.00617.14
8.0.20.0150.00617.40
8.0.10.0070.00016.92
8.0.00.0110.00616.84
7.4.330.0000.00515.55
7.4.320.0000.00716.52
7.4.300.0070.00016.51
7.4.290.0030.00316.44
7.4.280.0040.00416.64
7.4.270.0030.00316.57
7.4.260.0080.00013.31
7.4.250.0040.00416.59
7.4.240.0000.00816.57
7.4.230.0030.00316.42
7.4.220.0120.00916.57
7.4.210.0070.00916.64
7.4.200.0040.00416.55
7.4.160.0040.01216.61
7.4.150.0060.01117.40
7.4.140.0100.01117.86
7.4.130.0070.01816.50
7.4.120.0110.00716.66
7.4.110.0090.01316.49
7.4.100.0100.01316.47
7.4.90.0100.00616.49
7.4.80.0120.00619.39
7.4.70.0100.00716.63
7.4.60.0170.00016.50
7.4.50.0070.00516.66
7.4.40.0090.00916.54
7.4.30.0190.00016.57
7.4.00.0080.00415.22
7.3.330.0060.00013.48
7.3.320.0000.00513.38
7.3.310.0000.01016.50
7.3.300.0070.00016.47
7.3.290.0000.00716.32
7.3.280.0090.00816.45
7.3.270.0120.00817.40
7.3.260.0080.00916.69
7.3.250.0100.00916.46
7.3.240.0120.00516.51
7.3.230.0060.01216.61
7.3.210.0030.01316.47
7.3.200.0080.00816.68
7.3.190.0140.00316.60
7.3.180.0070.00716.43
7.3.170.0100.01016.52
7.3.160.0070.01016.43
7.3.10.0060.00616.70
7.3.00.0000.01616.71
7.2.330.0060.01316.51
7.2.320.0110.00816.76
7.2.310.0110.00616.83
7.2.300.0030.01516.81
7.2.290.0070.01016.57
7.2.130.0030.00616.89
7.2.120.0110.01116.93
7.2.110.0000.01416.89
7.2.100.0100.00316.70
7.2.90.0030.01117.07
7.2.80.0100.01016.87
7.2.70.0000.01116.97
7.2.60.0040.01216.99
7.2.50.0000.01117.04
7.2.40.0100.00516.80
7.2.30.0100.00816.93
7.2.20.0130.00416.93
7.2.10.0170.00716.91
7.2.00.0050.00818.15
7.1.250.0060.01215.82
7.1.200.0030.00915.77
7.1.100.0000.01218.41
7.1.70.0040.00417.21
7.1.60.2600.02033.26
7.1.50.1830.01332.96
7.1.40.2530.02032.55
7.1.30.2930.02032.73
7.1.20.2500.01732.69
7.1.10.2570.00714.73
7.1.00.3130.01014.67
7.0.200.2130.01014.96
7.0.190.0100.01315.04
7.0.180.0430.01014.40
7.0.170.2170.00714.51
7.0.160.2700.01714.55
7.0.150.2600.01314.64
7.0.140.0100.01014.52
7.0.130.0100.00714.62
7.0.120.0370.01714.52
7.0.110.0070.01314.44
7.0.100.0070.01714.66
7.0.90.0270.01314.61
7.0.80.0030.02014.62
7.0.70.0130.01314.45
7.0.60.0130.01014.29
7.0.50.3870.00714.64
7.0.40.1000.00714.83
7.0.30.0300.01014.86
7.0.20.0800.01714.64
7.0.10.0130.01714.76
7.0.00.0230.01714.76

preferences:
46.31 ms | 400 KiB | 5 Q