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 Items implements IteratorAggregate { private $items = []; public function __construct(Item ...$items) { $this->items = $items; } public function getIterator() : Generator { yield from $this->items; } } class Collection extends IteratorIterator { /** @var Items */ public function __construct(Items $items) { parent::__construct($items); } public function current() : Item { return parent::current(); } } $items = []; for ($i=0; $i<10; $i++) { $items[] = new Item($i); } $collection = new Collection(new Items(...$items)); foreach ($collection as $item) { printf("\tClass: %s. Calling id() method returns %d (%s)\n", get_class($item), $item->id(), gettype($item->id())); }

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.0090.00618.06
8.3.50.0070.01018.40
8.3.40.0040.01218.88
8.3.30.0090.00618.79
8.3.20.0040.00420.26
8.3.10.0050.00320.48
8.3.00.0050.00320.77
8.2.180.0130.00618.16
8.2.170.0070.00722.96
8.2.160.0120.00319.33
8.2.150.0050.00524.18
8.2.140.0030.00624.66
8.2.130.0080.00019.36
8.2.120.0080.00026.35
8.2.110.0030.00620.39
8.2.100.0050.00517.79
8.2.90.0080.00018.05
8.2.80.0000.00817.97
8.2.70.0040.00417.63
8.2.60.0040.00417.93
8.2.50.0060.00318.07
8.2.40.0050.00318.16
8.2.30.0050.00318.08
8.2.20.0040.00417.80
8.2.10.0030.00918.11
8.2.00.0040.00418.02
8.1.280.0060.01225.92
8.1.270.0040.00423.85
8.1.260.0080.00028.09
8.1.250.0070.00028.09
8.1.240.0070.00320.91
8.1.230.0090.00320.88
8.1.220.0030.00517.74
8.1.210.0030.00518.77
8.1.200.0040.00417.48
8.1.190.0040.00417.36
8.1.180.0060.00318.10
8.1.170.0080.00018.66
8.1.160.0030.00518.78
8.1.150.0000.00818.88
8.1.140.0030.00519.55
8.1.130.0030.00617.82
8.1.120.0040.00317.51
8.1.110.0050.00217.42
8.1.100.0050.00317.36
8.1.90.0040.00417.34
8.1.80.0060.00317.46
8.1.70.0070.00017.49
8.1.60.0040.00417.61
8.1.50.0050.00317.59
8.1.40.0000.00717.56
8.1.30.0040.00417.58
8.1.20.0040.00417.70
8.1.10.0050.00217.46
8.1.00.0040.00417.39
8.0.300.0070.00020.12
8.0.290.0000.00916.75
8.0.280.0040.00418.38
8.0.270.0000.00716.92
8.0.260.0060.00017.27
8.0.250.0040.00417.08
8.0.240.0000.00816.96
8.0.230.0000.00716.91
8.0.220.0000.00716.94
8.0.210.0040.00416.93
8.0.200.0080.00316.92
8.0.190.0040.00417.10
8.0.180.0040.00416.98
8.0.170.0050.00316.91
8.0.160.0070.00017.02
8.0.150.0040.00416.87
8.0.140.0070.00016.88
8.0.130.0070.00013.38
8.0.120.0000.00816.85
8.0.110.0030.00516.86
8.0.100.0040.00416.81
8.0.90.0040.00416.86
8.0.80.0110.00416.95
8.0.70.0070.00016.82
8.0.60.0000.00716.85
8.0.50.0070.00016.86
8.0.30.0070.01017.03
8.0.20.0100.01317.40
8.0.10.0030.00516.91
8.0.00.0080.01016.89
7.4.330.0050.00016.74
7.4.320.0030.00316.57
7.4.300.0000.00716.47
7.4.290.0040.00416.53
7.4.280.0070.00316.64
7.4.270.0000.00716.46
7.4.260.0040.00416.62
7.4.250.0040.00416.63
7.4.240.0050.00216.54
7.4.230.0040.00416.64
7.4.220.0120.01216.71
7.4.210.0160.00316.46
7.4.200.0030.00316.55
7.4.160.0030.01216.43
7.4.150.0150.00317.40
7.4.140.0080.01417.86
7.4.130.0120.00816.43
7.4.120.0140.00316.55
7.4.110.0070.01116.49
7.4.100.0140.00716.49
7.4.90.0090.00916.44
7.4.80.0090.00819.39
7.4.70.0090.01216.38
7.4.60.0120.00316.41
7.4.50.0080.00316.34
7.4.40.0120.00916.35
7.4.30.0110.00816.59
7.4.00.0100.00715.02
7.3.330.0030.00313.39
7.3.320.0000.00613.23
7.3.310.0000.00716.35
7.3.300.0040.00416.44
7.3.290.0080.01016.40
7.3.280.0090.01016.38
7.3.270.0070.01117.40
7.3.260.0140.00416.43
7.3.250.0130.00516.46
7.3.240.0050.01216.49
7.3.230.0110.00716.46
7.3.210.0120.00616.45
7.3.200.0090.00916.59
7.3.190.0100.00616.44
7.3.180.0060.00916.38
7.3.170.0060.01616.62
7.3.160.0080.00916.33
7.2.330.0100.00716.78
7.2.320.0090.00916.49
7.2.310.0100.00716.83
7.2.300.0110.00816.79
7.2.290.0060.01116.89
7.2.60.0030.00616.86
7.1.200.0070.00715.84
7.1.90.0320.01316.31
7.1.80.0280.01516.26
7.1.70.0140.00816.37
7.1.60.0310.00525.27
7.1.50.0180.01324.95
7.1.40.0270.01732.65
7.1.30.0360.01432.75
7.1.20.0330.02032.71
7.1.10.0180.01214.83
7.1.00.0190.04418.61
7.0.200.0180.00915.90
7.0.190.0310.00615.14
7.0.180.0210.00714.48
7.0.170.0260.00614.40
7.0.160.0220.00614.59
7.0.150.0320.01214.26
7.0.140.0890.01014.59
7.0.130.0190.01214.57
7.0.120.0270.01014.77
7.0.110.0270.01014.75
7.0.100.0250.00914.66
7.0.90.0180.01414.65
7.0.80.0250.00714.69
7.0.70.0380.00614.77
7.0.60.0230.04018.08
7.0.50.0130.04416.31
7.0.40.0130.04517.39
7.0.30.0340.04017.48
7.0.20.0270.02817.62
7.0.10.0190.04817.49
7.0.00.0110.05017.34
5.6.300.0070.06720.74
5.6.290.0160.06920.77
5.6.280.0100.05820.83
5.6.270.0170.06421.05
5.6.260.0280.05020.82
5.6.250.0180.04220.85
5.6.240.0170.06020.79
5.6.230.0260.06220.93
5.6.220.0200.07020.89
5.6.210.0050.07420.70
5.6.200.0070.07519.51
5.6.190.0080.06620.63
5.6.180.0250.07420.76
5.6.170.0180.05420.70
5.6.160.0110.04620.66
5.6.150.0120.06719.53
5.6.140.0090.05119.52
5.6.130.0100.06519.60
5.6.120.0170.06321.06
5.6.110.0120.06220.89
5.6.100.0160.05420.87
5.6.90.0110.06921.07
5.6.80.0080.05720.35
5.6.70.0130.05320.15
5.6.60.0070.06120.13
5.6.50.0160.05120.20
5.6.40.0150.05220.34
5.6.30.0130.07320.11
5.6.20.0030.06220.21
5.6.10.0070.06220.23
5.6.00.0000.06220.35
5.5.380.0060.06417.47
5.5.370.0090.06017.61
5.5.360.0060.07617.54
5.5.350.2000.05218.91
5.5.340.0030.07218.00
5.5.330.0060.07119.12
5.5.320.0300.06119.15
5.5.310.0250.06419.19
5.5.300.0110.06018.11
5.5.290.0080.07017.85
5.5.280.0070.07319.38
5.5.270.0070.05019.34
5.5.260.0070.04819.39
5.5.250.0150.06619.25
5.5.240.0130.04218.74
5.5.230.0200.04417.50
5.5.220.0130.04917.34
5.5.210.0160.04617.35
5.5.200.0100.05217.06
5.5.190.0160.07217.29
5.5.180.0100.07217.17
5.5.160.0040.05717.43
5.5.150.0100.04817.37
5.5.140.0160.05117.37
5.5.130.0160.05717.29
5.5.120.0200.04217.48
5.5.110.0230.03917.34
5.5.100.0160.06917.20
5.5.90.0160.04517.38
5.5.80.0030.05617.28
5.5.70.0130.05017.27
5.5.60.0030.05517.18
5.5.50.0170.04717.36
5.5.40.0140.04517.18
5.5.30.0200.04617.37
5.5.20.0130.07217.27
5.5.10.0100.07517.23
5.5.00.0100.05117.27
5.4.450.0200.05419.37
5.4.440.0180.06019.45
5.4.430.0160.05419.56
5.4.420.0130.05919.39
5.4.410.0140.05419.24
5.4.400.0100.05819.06
5.4.390.0180.05019.08
5.4.380.0200.04919.03
5.4.370.0200.05119.09
5.4.360.0180.05419.13
5.4.350.0160.06219.02
5.4.340.0130.05919.06
5.4.320.0200.05919.10
5.4.310.0120.05619.14
5.4.300.0250.05419.12
5.4.290.0220.05119.21
5.4.280.0170.06219.12
5.4.270.0170.05719.05
5.4.260.0120.06719.04
5.4.250.0250.05419.13
5.4.240.0150.05019.16
5.4.230.0150.05119.17
5.4.220.0160.05219.05
5.4.210.0200.05319.06
5.4.200.0110.05319.00
5.4.190.0210.04419.08
5.4.180.0120.06619.13
5.4.170.0180.05219.02
5.4.160.0100.05819.09
5.4.150.0150.05319.17
5.4.140.0120.05616.49
5.4.130.0080.05316.51
5.4.120.0150.06516.57
5.4.110.0100.04916.64
5.4.100.0070.05116.59
5.4.90.0000.05516.64
5.4.80.0100.04816.40
5.4.70.0070.05416.68
5.4.60.0170.05316.40
5.4.50.0070.04816.60
5.4.40.0160.04416.44
5.4.30.0070.05216.61
5.4.20.0120.04816.35
5.4.10.0100.04916.45
5.4.00.0110.04616.12
5.3.290.0190.04914.72
5.3.280.0110.05514.64
5.3.270.0130.05314.65
5.3.260.0210.05714.75
5.3.250.0150.05114.82
5.3.240.0130.05214.73
5.3.230.0170.05814.57
5.3.220.0100.05114.66
5.3.210.0070.05614.86
5.3.200.0030.05514.63
5.3.190.0160.04314.45
5.3.180.0100.04914.83
5.3.170.0070.05014.84
5.3.160.0140.05414.87
5.3.150.0190.04214.85
5.3.140.0060.05714.55
5.3.130.0130.04714.83
5.3.120.0030.06014.60
5.3.110.0100.06014.83
5.3.100.0070.05114.16
5.3.90.0200.04214.14
5.3.80.0070.05014.04
5.3.70.0070.05414.14
5.3.60.0140.05114.21
5.3.50.0100.04514.22
5.3.40.0160.05913.95
5.3.30.0140.04413.91
5.3.20.0060.05513.87
5.3.10.0100.05313.83
5.3.00.0070.05013.64
5.2.170.0140.03811.35
5.2.160.0100.04211.45
5.2.150.0160.03211.37
5.2.140.0000.05111.43
5.2.130.0030.04310.98
5.2.120.0090.03511.10
5.2.110.0030.04611.39
5.2.100.0000.05011.40
5.2.90.0100.04511.06
5.2.80.0070.04011.16
5.2.70.0090.03911.09
5.2.60.0070.05211.18
5.2.50.0070.05611.31
5.2.40.0100.04611.20
5.2.30.0060.04111.09
5.2.20.0100.03511.25
5.2.10.0030.04211.13
5.2.00.0040.06010.73
5.1.60.0030.0379.99
5.1.50.0060.03510.31
5.1.40.0140.03810.03
5.1.30.0000.05610.63
5.1.20.0070.04110.64
5.1.10.0030.03710.26
5.1.00.0090.03210.36
5.0.50.0090.0258.76
5.0.40.0070.0368.51
5.0.30.0130.0338.32
5.0.20.0120.0218.50
5.0.10.0100.0318.47
5.0.00.0090.0498.38
4.4.90.0030.0226.26
4.4.80.0070.0276.26
4.4.70.0000.0256.26
4.4.60.0070.0196.26
4.4.50.0060.0196.26
4.4.40.0030.0356.26
4.4.30.0060.0256.26
4.4.20.0040.0226.26
4.4.10.0090.0266.26
4.4.00.0030.0336.26
4.3.110.0030.0226.26
4.3.100.0060.0186.26
4.3.90.0040.0256.26
4.3.80.0000.0386.26
4.3.70.0000.0256.26
4.3.60.0070.0176.26
4.3.50.0030.0276.26
4.3.40.0030.0316.26
4.3.30.0000.0246.26
4.3.20.0000.0256.26
4.3.10.0030.0216.26
4.3.00.0060.0176.26

preferences:
64.38 ms | 400 KiB | 5 Q