3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Item { private $id; public function __construct(int $id) { $this->id = $id; } public function id() : int { return $this->id; } } class Collection { private $items = []; public function __construct(Item ...$items) { $this->items = $items; } public function item() : Generator { yield from $this->items; } } $items = []; for ($i=0; $i<10; $i++) { $items[] = new Item($i); } $collection = new Collection(...$items); $generator = $collection->item(); printf("\nThe Collection::item() method returns a type of %s, as expected\n", get_class($generator)); printf("However, it yields the following:\n\n"); foreach ($generator as $item) { printf("\tClass: %s. Calling id() method returns %d (%s)\n", get_class($item), $item->id(), gettype($item->id())); } printf("\n\nIt doesn't appear to be possible to hint the yielded type\n\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)
8.4.130.0120.00817.64
8.4.120.0060.00320.45
8.4.110.0080.01222.41
8.4.100.0130.00717.89
8.4.90.0100.01018.68
8.4.80.0130.00617.58
8.4.70.0090.01117.71
8.4.60.0130.00718.88
8.4.50.0110.00817.94
8.4.40.0040.00817.37
8.4.30.0080.01217.54
8.4.20.0090.00617.83
8.4.10.0070.01317.54
8.3.260.0090.00916.79
8.3.250.0110.00618.98
8.3.240.0110.00816.48
8.3.230.0100.00816.49
8.3.220.0090.00717.32
8.3.210.0140.00616.55
8.3.200.0050.00416.63
8.3.190.0050.00219.14
8.3.180.0080.00616.55
8.3.170.0060.01218.97
8.3.160.0100.00718.24
8.3.150.0100.00716.46
8.3.140.0140.00417.15
8.3.130.0060.00316.57
8.3.120.0040.00420.61
8.3.110.0060.00316.61
8.3.100.0040.00418.59
8.3.90.0100.01026.77
8.3.80.0000.00918.43
8.3.70.0070.00716.63
8.3.60.0080.00818.31
8.3.50.0100.00822.87
8.3.40.0060.01218.82
8.3.30.0040.01118.89
8.3.20.0080.00020.42
8.3.10.0040.00420.51
8.3.00.0050.00320.82
8.2.290.0110.00820.41
8.2.280.0130.00718.63
8.2.270.0060.00317.15
8.2.260.0060.01216.68
8.2.250.0090.00016.90
8.2.240.0120.00617.39
8.2.230.0060.00320.94
8.2.220.0030.00624.06
8.2.210.0150.00026.77
8.2.200.0090.00018.13
8.2.190.0060.00916.88
8.2.180.0090.00618.06
8.2.170.0120.00322.96
8.2.160.0060.01021.93
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0070.00019.95
8.2.110.0000.00922.21
8.2.100.0080.00417.84
8.2.90.0060.00317.91
8.2.80.0030.00619.11
8.2.70.0000.00917.63
8.2.60.0090.00017.93
8.2.50.0000.00818.09
8.2.40.0040.00420.59
8.2.30.0040.00419.48
8.2.20.0000.00717.82
8.2.10.0040.00418.14
8.2.00.0040.00418.14
8.1.330.0130.00522.03
8.1.320.0110.00416.45
8.1.310.0030.01518.29
8.1.300.0080.00316.25
8.1.290.0030.00630.84
8.1.280.0100.01025.92
8.1.270.0080.00023.79
8.1.260.0070.00026.35
8.1.250.0130.00328.09
8.1.240.0050.00322.13
8.1.230.0090.00320.88
8.1.220.0040.00417.74
8.1.210.0030.00518.78
8.1.200.0040.00717.36
8.1.190.0050.00317.38
8.1.180.0000.00818.10
8.1.170.0000.00918.46
8.1.160.0000.00720.65
8.1.150.0040.00418.80
8.1.140.0000.00819.57
8.1.130.0000.00817.71
8.1.120.0000.01017.54
8.1.110.0080.00017.45
8.1.100.0050.00317.42
8.1.90.0000.00817.54
8.1.80.0070.00417.46
8.1.70.0000.00817.39
8.1.60.0090.00017.47
8.1.50.0040.00417.50
8.1.40.0040.00417.48
8.1.30.0030.00617.64
8.1.20.0020.00517.39
8.1.10.0000.00817.60
8.1.00.0080.00017.53
8.0.300.0080.00320.02
8.0.290.0050.00216.75
8.0.280.0030.00318.39
8.0.270.0030.00317.32
8.0.260.0060.00017.22
8.0.250.0030.00316.95
8.0.240.0080.00016.86
8.0.230.0040.00417.01
8.0.220.0030.00516.79
8.0.210.0070.00016.77
8.0.200.0000.00716.83
8.0.190.0040.00416.83
8.0.180.0040.00416.94
8.0.170.0040.00416.84
8.0.160.0000.00716.95
8.0.150.0070.00316.86
8.0.140.0090.00316.76
8.0.130.0000.00613.32
8.0.120.0080.00016.78
8.0.110.0050.00316.88
8.0.100.0050.00216.85
8.0.90.0000.00816.95
8.0.80.0060.00916.89
8.0.70.0020.00516.82
8.0.60.0020.00516.88
8.0.50.0040.00416.94
8.0.30.0100.00917.10
8.0.20.0120.00617.41
8.0.10.0000.00716.98
8.0.00.0080.01216.74
7.4.330.0000.00616.66
7.4.320.0030.00316.42
7.4.300.0040.00416.61
7.4.290.0000.00716.64
7.4.280.0040.00416.60
7.4.270.0030.00316.45
7.4.260.0000.00816.49
7.4.250.0040.00416.45
7.4.240.0050.00216.61
7.4.230.0000.00716.49
7.4.220.0130.01416.62
7.4.210.0070.01016.59
7.4.200.0040.00416.45
7.4.160.0160.00016.55
7.4.150.0130.00617.40
7.4.140.0140.00617.86
7.4.130.0110.00716.43
7.4.120.0080.01016.41
7.4.110.0090.00816.40
7.4.100.0080.00816.38
7.4.90.0070.01116.36
7.4.80.0100.00717.90
7.4.70.0120.00816.43
7.4.60.0080.01016.52
7.4.50.0100.00616.37
7.4.40.0070.01016.48
7.4.30.0080.01316.54
7.4.20.0120.01216.49
7.4.10.0110.00715.85
7.4.00.0070.01015.24
7.3.330.0030.00313.46
7.3.320.0000.00513.44
7.3.310.0000.00716.47
7.3.300.0070.00016.42
7.3.290.0070.00016.38
7.3.280.0030.01316.37
7.3.270.0170.00017.40
7.3.260.0120.01116.41
7.3.250.0090.00916.35
7.3.240.0110.00616.43
7.3.230.0120.00416.56
7.3.220.0080.00816.27
7.3.210.0070.00916.36
7.3.200.0090.01216.54
7.3.190.0100.00716.38
7.3.180.0110.00616.36
7.3.170.0110.00916.41
7.3.160.0090.00916.48
7.3.150.0150.00916.46
7.3.140.0070.01016.25
7.3.130.0120.00415.40
7.3.120.0070.01115.20
7.3.110.0070.01115.18
7.3.100.0060.00915.15
7.3.90.0060.01115.23
7.3.80.0050.00915.21
7.3.70.0070.00615.21
7.3.60.0060.00715.18
7.3.50.0070.00815.25
7.3.40.0040.00915.12
7.3.30.0090.00715.17
7.3.20.0060.00916.71
7.3.10.0070.00816.55
7.3.00.0090.00716.50
7.2.340.0220.00916.76
7.2.330.0170.00816.79
7.2.320.0140.01516.66
7.2.310.0190.01016.73
7.2.300.0170.01016.75
7.2.290.0200.00816.63
7.2.280.0340.01016.73
7.2.270.0340.00316.54
7.2.260.0130.01215.89
7.2.250.0140.00815.61
7.2.240.0130.00815.49
7.2.230.0090.01215.54
7.2.220.0150.00815.62
7.2.210.0090.00815.42
7.2.200.0110.00915.50
7.2.190.0110.00615.49
7.2.180.0080.00815.41
7.2.170.0110.00815.47
7.2.160.0140.00915.59
7.2.150.0130.00916.81
7.2.140.0130.00716.91
7.2.130.0140.01216.84
7.2.120.0100.01016.80
7.2.110.0140.00516.86
7.2.100.0160.01116.85
7.2.90.0150.00917.03
7.2.80.0120.01116.85
7.2.70.0100.01116.84
7.2.60.0110.00816.85
7.2.50.0120.01016.78
7.2.40.0270.00616.83
7.2.30.0140.00716.97
7.2.20.0110.01116.89
7.2.10.0120.01216.93
7.2.00.0110.01017.49
7.1.330.0110.00715.76
7.1.320.0130.00715.79
7.1.310.0070.00915.78
7.1.300.0110.00515.77
7.1.290.0090.00815.75
7.1.280.0110.00715.77
7.1.270.0120.00715.62
7.1.260.0100.00915.73
7.1.250.0220.00515.69
7.1.240.0190.00815.67
7.1.230.0130.01015.77
7.1.220.0090.01215.55
7.1.210.0180.00515.67
7.1.200.0130.00515.65
7.1.190.0140.01515.62
7.1.180.0220.00215.73
7.1.170.0220.00515.63
7.1.160.0150.00715.58
7.1.150.0120.01015.61
7.1.140.0160.00815.64
7.1.130.0160.01115.63
7.1.120.0140.00915.65
7.1.110.0170.00315.70
7.1.100.0170.00416.50
7.1.90.0140.01015.66
7.1.80.0300.00715.66
7.1.70.0090.00716.22
7.1.60.0090.01417.08
7.1.50.0100.01216.13
7.1.40.0170.01015.56
7.1.30.0120.01015.80
7.1.20.0130.00815.78
7.1.10.0160.00715.56
7.1.00.0140.03017.86
7.0.330.0210.00415.43
7.0.320.0170.00515.36
7.0.310.0190.01515.37
7.0.300.0120.00915.32
7.0.290.0140.01215.21
7.0.280.0180.00715.29
7.0.270.0130.00815.32
7.0.260.0150.00815.25
7.0.250.0140.00715.44
7.0.240.0160.00915.38
7.0.230.0100.01215.31
7.0.220.0120.00815.37
7.0.210.0210.00515.38
7.0.200.0130.00715.17
7.0.190.0140.00815.21
7.0.180.0180.00215.34
7.0.170.0120.01015.34
7.0.160.0150.00815.38
7.0.150.0170.00715.41
7.0.140.0100.01315.41
7.0.130.0080.01115.42
7.0.120.0110.01015.45
7.0.110.0130.01115.26
7.0.100.0350.00515.35
7.0.90.0100.01315.33
7.0.80.0110.00815.29
7.0.70.0140.01015.41
7.0.60.0080.02417.48
7.0.50.0090.02216.20
7.0.40.0080.02816.28
7.0.30.0230.02316.24
7.0.20.0220.02616.28
7.0.10.0080.03516.28
7.0.00.0040.02516.09
5.6.400.0100.01114.84
5.6.390.0130.00914.94
5.6.380.0130.00814.92
5.6.370.0220.00515.00
5.6.360.0170.00314.83
5.6.350.0140.00714.90
5.6.340.0100.01214.89
5.6.330.0150.00714.98
5.6.320.0160.00515.01
5.6.310.0160.00514.79
5.6.300.0150.00715.05
5.6.290.0060.01814.85
5.6.280.0140.00814.96
5.6.270.0090.01315.03
5.6.260.0170.00614.90
5.6.250.0140.00915.03
5.6.240.0180.00814.85
5.6.230.0110.00714.93
5.6.220.0190.00814.92
5.6.210.0100.03416.70
5.6.200.0100.02416.05
5.6.190.0130.02716.86
5.6.180.0220.02716.72
5.6.170.0170.03116.71
5.6.160.0100.02016.80
5.6.150.0120.02915.87
5.6.140.0140.03216.03
5.6.130.0130.03616.01
5.6.120.0120.02016.91
5.6.110.0080.03116.92
5.6.100.0120.03316.89
5.6.90.0090.03616.90
5.6.80.0060.02216.68
5.6.70.0160.00514.79
5.6.60.0110.01014.69
5.6.50.0130.00514.88
5.6.40.0100.01214.68
5.6.30.0120.00614.80
5.6.20.0130.00914.87
5.6.10.0130.01414.76
5.6.00.0160.00514.73
5.5.380.0160.00714.88
5.5.370.0140.00614.88
5.5.360.0090.01214.87
5.5.350.0190.03216.62
5.5.340.0090.03515.80
5.5.330.0130.02816.62
5.5.320.0150.02016.63
5.5.310.0140.02916.56
5.5.300.0160.01915.84
5.5.290.0100.02115.94
5.5.280.0120.02316.84
5.5.270.0120.02716.84
5.5.260.0080.04216.79
5.5.250.0110.03316.72
5.5.240.0100.02916.67
5.5.230.0130.01014.69
5.5.220.0130.01114.81
5.5.210.0130.00614.70
5.5.200.0100.01214.80
5.5.190.0130.01214.51
5.5.180.0130.01014.75
5.5.170.0090.01714.61
5.5.160.0140.00714.70
5.5.150.0130.00514.55
5.5.140.0170.00414.73
5.5.130.0130.00714.67
5.5.120.0120.01014.76
5.5.110.0100.01114.84
5.5.100.0130.01114.81
5.5.90.0190.00714.66
5.5.80.0120.00914.67
5.5.70.0100.01314.86
5.5.60.0180.00614.83
5.5.50.0120.01014.78
5.5.40.0130.00914.73
5.5.30.0150.01014.64
5.5.20.0150.00614.60
5.5.10.0160.00814.68
5.5.00.0160.00814.67

preferences:
31.98 ms | 403 KiB | 5 Q