3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public $data = []; function __construct($data){ $this->data = $data; } function &getIterator() { foreach ($this->data as $key => &$value) { yield $key => $value; } } function printData() { foreach ($this->data as $key => $value) { echo($key . ':' . $value . PHP_EOL); } } } $data = array('one'=>'Curly', 'two'=>'Larry', 'three'=>'Moe'); $t = new Test($data); foreach ($t->getIterator() as $key => &$value) { $value = strtoupper($value); } $t->printData();

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.70.0090.00618.18
8.3.60.0030.01218.55
8.3.50.0150.00018.30
8.3.40.0120.00318.54
8.3.30.0090.00618.68
8.3.20.0070.00020.34
8.3.10.0060.00620.15
8.3.00.0000.00820.69
8.2.180.0110.00716.50
8.2.170.0070.00722.96
8.2.160.0100.00319.46
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0000.01019.83
8.2.120.0000.00826.35
8.2.110.0070.00321.04
8.2.100.0040.00817.78
8.2.90.0080.00017.75
8.2.80.0040.00418.04
8.2.70.0030.00518.04
8.2.60.0090.00018.22
8.2.50.0000.00818.10
8.2.40.0060.00320.41
8.2.30.0020.00519.19
8.2.20.0070.00018.02
8.2.10.0040.00418.18
8.2.00.0000.00818.05
8.1.280.0170.00325.92
8.1.270.0070.00022.20
8.1.260.0070.00026.35
8.1.250.0070.00028.09
8.1.240.0000.00923.79
8.1.230.0060.00620.92
8.1.220.0040.00417.74
8.1.210.0040.01118.77
8.1.200.0000.01117.23
8.1.190.0040.00417.23
8.1.180.0040.00418.10
8.1.170.0040.00418.90
8.1.160.0040.00418.83
8.1.150.0000.00720.13
8.1.140.0000.00719.46
8.1.130.0030.00318.95
8.1.120.0050.00217.48
8.1.110.0080.00017.45
8.1.100.0040.00417.39
8.1.90.0040.00417.37
8.1.80.0000.00717.38
8.1.70.0000.00717.39
8.1.60.0030.00517.51
8.1.50.0000.00817.41
8.1.40.0080.00017.37
8.1.30.0000.00817.59
8.1.20.0000.00817.55
8.1.10.0000.00817.63
8.1.00.0070.00317.53
8.0.300.0030.00519.60
8.0.290.0040.00416.75
8.0.280.0040.00418.45
8.0.270.0040.00417.31
8.0.260.0000.00618.89
8.0.250.0070.00016.96
8.0.240.0070.00016.89
8.0.230.0030.00316.95
8.0.220.0000.00616.90
8.0.210.0000.00716.78
8.0.200.0000.00716.89
8.0.190.0090.00016.97
8.0.180.0000.00816.94
8.0.170.0030.00516.89
8.0.160.0040.00416.84
8.0.150.0060.00316.73
8.0.140.0070.00016.77
8.0.130.0050.00513.35
8.0.120.0040.00416.89
8.0.110.0000.00816.83
8.0.100.0040.00416.72
8.0.90.0000.00717.00
8.0.80.0070.00716.87
8.0.70.0030.00316.78
8.0.60.0050.00216.95
8.0.50.0000.00816.80
8.0.30.0150.00516.97
8.0.20.0130.00817.40
8.0.10.0030.00317.14
8.0.00.0000.01916.60
7.4.330.0050.00015.55
7.4.320.0070.00016.53
7.4.300.0000.00716.58
7.4.290.0000.00716.41
7.4.280.0000.00816.60
7.4.270.0070.00016.64
7.4.260.0050.00216.49
7.4.250.0050.00216.41
7.4.240.0070.00016.46
7.4.230.0040.00416.50
7.4.220.0060.01316.60
7.4.210.0070.00716.59
7.4.200.0030.00416.70
7.4.160.0110.00716.37
7.4.150.0180.00617.40
7.4.140.0120.00817.86
7.4.130.0090.00916.49
7.4.120.0140.01116.57
7.4.110.0060.01216.57
7.4.100.0130.00816.55
7.4.90.0170.00016.48
7.4.80.0070.01119.39
7.4.70.0110.00716.64
7.4.60.0090.01316.52
7.4.50.0100.00416.57
7.4.40.0030.01716.51
7.4.30.0120.00616.66
7.4.00.0140.00414.80
7.3.330.0050.00013.23
7.3.320.0040.00413.10
7.3.310.0000.00716.21
7.3.300.0060.00016.24
7.3.290.0000.00716.21
7.3.280.0070.00816.35
7.3.270.0150.00917.40
7.3.260.0140.00616.53
7.3.250.0100.01016.45
7.3.240.0090.01016.41
7.3.230.0030.01316.39
7.3.210.0130.01016.63
7.3.200.0060.01016.71
7.3.190.0100.00616.64
7.3.180.0060.01816.31
7.3.170.0030.01316.64
7.3.160.0120.00416.56
7.3.120.0080.00514.81
7.3.110.0070.01014.65
7.3.100.0070.00414.80
7.3.90.0000.00714.73
7.3.80.0000.01515.11
7.3.70.0040.00814.88
7.3.60.0070.00014.79
7.3.50.0030.00914.61
7.3.40.0060.00614.81
7.3.30.0070.00714.82
7.3.20.0000.01216.63
7.3.10.0060.00616.35
7.3.00.0070.00716.80
7.2.330.0120.00616.70
7.2.320.0150.00316.81
7.2.310.0030.01316.88
7.2.300.0080.00816.83
7.2.290.0080.00816.88
7.2.240.0060.00914.56
7.2.230.0060.00315.03
7.2.220.0000.01014.84
7.2.210.0030.01015.10
7.2.200.0000.01414.85
7.2.190.0000.01314.89
7.2.180.0060.00615.04
7.2.170.0070.00714.82
7.2.160.0000.01715.12
7.2.150.0030.00916.73
7.2.140.0060.00616.88
7.2.130.0030.01316.89
7.2.120.0070.00716.88
7.2.110.0220.01116.74
7.2.100.0100.00316.93
7.2.90.0100.00317.18
7.2.80.0000.01516.78
7.2.70.0030.00616.91
7.2.60.0150.00516.72
7.2.50.0030.00916.99
7.2.40.0090.00616.80
7.2.30.0000.01517.16
7.2.20.0070.00316.81
7.2.10.0030.00617.11
7.2.00.0030.01016.96
7.1.330.0040.01215.85
7.1.320.0060.00915.67
7.1.310.0070.00415.55
7.1.300.0030.01015.56
7.1.290.0060.00615.73
7.1.280.0100.00015.76
7.1.270.0070.00615.56
7.1.260.0080.00515.76
7.1.250.0030.00515.80
7.1.200.0030.01015.94
7.1.80.0060.01118.12
7.1.70.0050.01117.22
7.1.60.0220.01135.13
7.1.50.0190.01234.58
7.1.40.0220.00834.27
7.1.30.0220.01034.45
7.1.20.0260.00734.64
7.1.10.0060.00616.50
7.1.00.0060.01116.42
7.0.200.0050.00916.73
7.0.190.0140.00216.86
7.0.180.0080.01216.20
7.0.170.0070.01016.38
7.0.160.0060.01216.51
7.0.150.0030.01016.20
7.0.140.0030.01316.39
7.0.130.0030.01516.29
7.0.120.0060.01116.41
7.0.110.0090.00716.31
7.0.100.0000.01616.25
7.0.90.0000.01416.21
7.0.80.0090.00516.09
7.0.70.0030.01316.14
7.0.60.0060.00616.19
7.0.50.0050.01316.46
7.0.40.0070.01016.64
7.0.30.0060.01016.64
7.0.20.0100.00716.48
7.0.10.0060.01016.54
7.0.00.0110.00816.46

preferences:
58.84 ms | 400 KiB | 5 Q