3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class Handler{ function __construct(private $n, private $s, private $succ){} function isMatched(int $n):bool{return$n%$this->n===0?><?php} function __invoke(int $n){return $this->isMatched($n) ? $this : ($this->succ)($n)?><?php } function __toString(){ return $this->s?><?php }} foreach(new class( new Handler(15, \FizzBuzz::class, new Handler(3, \Fizz::class, new Handler(5, \Buzz::class, fn($n) => (string)$n, ))), range(1, 100)) implements IteratorAggregate{ function __construct(private $handler, private $input){} function getIterator(): Generator { return (function() { foreach($this->input as $n) yield ($this->handler)($n) ?><?php })()?><?php } } as $fizzbuzz) echo $fizzbuzz,PHP_EOL?>

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.0.00.0070.01016.88
7.4.130.0030.01316.49
7.4.120.0100.01316.43
7.4.110.0100.01016.43
7.4.100.0120.00616.27
7.4.90.0040.01216.25
7.4.80.0100.00616.29
7.4.70.0290.02716.25
7.4.60.0070.01616.49
7.4.50.0130.00716.43
7.4.40.0070.01116.26
7.4.30.0060.01616.50
7.4.20.0090.00616.43
7.4.10.0170.00016.47
7.4.00.0110.00616.29
7.3.250.0090.00616.12
7.3.240.0090.01216.33
7.3.230.0060.01216.27
7.3.220.0120.00616.41
7.3.210.0060.01116.12
7.3.200.0100.00716.13
7.3.190.0060.01016.26
7.3.180.0070.01416.12
7.3.170.0070.01016.33
7.3.160.0180.00516.25
7.3.150.0120.00816.28
7.3.140.0100.00716.23
7.3.130.0070.01016.21
7.3.120.0130.01016.36
7.3.110.0130.00316.21
7.3.100.0130.00316.14
7.3.90.0130.00316.18
7.3.80.0140.00316.25
7.3.70.0100.00716.11
7.3.60.0030.01316.24
7.3.50.0130.00316.24
7.3.40.0080.00816.21
7.3.30.0130.00316.33
7.3.20.0030.01716.12
7.3.10.0150.00816.25
7.3.00.0160.00416.28

preferences:
140.1 ms | 1440 KiB | 7 Q