3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo {} class Foos implements IteratorAggregate { private function __construct(private readonly Closure $foos) {} public static function fromVariadic(Foo ...$foos): self { return new self(fn() => yield from $foos); } public static function fromGenerator(callable $generator): self { return new self($generator); } public function getIterator(): \Traversable { return ($this->foos)(); } } //$foos = Foos::fromVariadic(new Foo, new Foo); $foos = Foos::fromGenerator(function() { yield new Foo; yield new Foo; }); foreach ($foos as $foo) { var_dump($foo); }

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.5.00.0130.00920.01
8.4.150.0030.00014.05
8.4.140.0120.00917.30
8.4.130.0120.00817.72
8.4.120.0040.00420.48
8.4.110.0100.00819.06
8.4.100.0130.00619.13
8.4.90.0130.00720.61
8.4.80.0140.00618.60
8.4.70.0080.01219.04
8.4.60.0130.00818.48
8.4.50.0040.00517.98
8.4.40.0050.00517.49
8.4.30.0070.01320.46
8.4.20.0080.00817.82
8.4.10.0040.00417.56
8.3.280.0110.01118.54
8.3.270.0110.01016.73
8.3.260.0070.00416.64
8.3.250.0100.00919.04
8.3.240.0090.01016.71
8.3.230.0130.00316.82
8.3.220.0120.00618.70
8.3.210.0100.01018.59
8.3.200.0060.00216.68
8.3.190.0090.01017.17
8.3.180.0090.00616.53
8.3.170.0100.01019.04
8.3.160.0180.00017.13
8.3.150.0130.00617.14
8.3.140.0050.00316.52
8.3.130.0080.01116.67
8.3.120.0060.00318.99
8.3.110.0000.00822.58
8.3.100.0000.00822.58
8.3.90.0060.01022.58
8.3.50.0030.00622.58
8.2.290.0080.00120.38
8.2.280.0130.00818.33
8.2.270.0090.00617.19
8.2.260.0100.00018.28
8.2.250.0040.00416.84
8.2.240.0080.00017.23
8.2.230.0050.00222.58
8.2.220.0100.00022.58
8.2.210.0060.00322.58
8.1.330.0120.00916.41
8.1.320.0140.00616.08
8.1.310.0060.00917.12
8.1.300.0070.00416.37
8.1.30.0050.00517.62

preferences:
20.02 ms | 403 KiB | 5 Q