3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Container extends ArrayObject { function __set($k,$c){$this[$k]=$c;} function __get($k){return $this->get($k);} function get(string $id){return $this[$id]($this);} function has(string $id): bool {return isset($this[$id]);} } class Fizz { public function __toString() { return 'Fizz'; } } class Buzz { public function __toString() { return 'Buzz'; } } class FizzBuzz { public function __construct( private Fizz $fizz, private Buzz $buzz ) {} public function __invoke(int $i): string { if (!($i % 15)) return $this->fizz . $this->buzz; if (!($i % 3)) return (string) $this->fizz; if (!($i % 5)) return (string) $this->buzz; return (string) $i; } } $c = new Container; $c->fizz = fn () => new Fizz; $c->buzz = fn () => new Buzz; $c->fizzBuzz = fn ($c) => new FizzBuzz($c->fizz, $c->buzz); foreach (range(1, 15) as $i) { echo $c->get('fizzBuzz')($i) . "\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.10.0050.00522.13
8.3.140.0060.00320.59
8.3.130.0090.01218.36
8.3.120.0060.00319.08
8.3.110.0040.00420.94
8.3.100.0030.00616.77
8.3.90.0100.01026.77
8.3.80.0050.00517.97
8.3.70.0090.00916.63
8.3.60.0070.01416.50
8.3.50.0000.01618.57
8.3.40.0040.01121.87
8.3.30.0040.01218.66
8.3.20.0040.00424.18
8.3.10.0000.00824.66
8.3.00.0000.00826.16
8.2.250.0130.00718.49
8.2.240.0080.00017.22
8.2.230.0000.00822.58
8.2.220.0000.01224.06
8.2.210.0120.00826.77
8.2.200.0040.00418.16
8.2.190.0150.00016.75
8.2.180.0110.00718.16
8.2.170.0130.01019.09
8.2.160.0090.00922.96
8.2.150.0080.00025.66
8.2.140.0030.00524.66
8.2.130.0070.00026.16
8.2.120.0070.00020.86
8.2.110.0100.00020.98
8.2.100.0060.01017.79
8.2.90.0040.00417.75
8.2.80.0040.00718.78
8.2.70.0030.00517.50
8.2.60.0090.00917.48
8.2.50.0120.00617.63
8.2.40.0090.00917.75
8.2.30.0170.00317.50
8.2.20.0160.00017.74
8.2.10.0110.00517.38
8.2.00.0080.00817.63
8.1.300.0090.00017.98
8.1.290.0000.00818.88
8.1.280.0070.01425.92
8.1.270.0000.00824.66
8.1.260.0000.00826.35
8.1.250.0070.00328.09
8.1.240.0030.00620.92
8.1.230.0120.00017.54
8.1.220.0000.00917.74
8.1.210.0050.00318.77
8.1.200.0000.00817.35
8.1.190.0140.00517.13
8.1.180.0100.00717.13
8.1.170.0140.00317.13
8.1.160.0110.00417.38
8.1.150.0050.01116.75
8.1.140.0140.00517.00
8.1.130.0080.00817.55
8.1.120.0080.00817.13
8.1.110.0180.00016.88
8.1.100.0120.00417.25
8.1.90.0160.00017.25
8.1.80.0080.00816.88
8.1.70.0040.01217.13
8.1.60.0050.01117.25
8.1.50.0180.00017.25
8.1.40.0110.00817.25
8.1.30.0210.00017.25
8.1.20.0200.00317.25
8.1.10.0150.00517.38
8.1.00.0180.00317.13
8.0.300.0000.00818.77
8.0.290.0030.00616.75
8.0.280.0140.00516.75
8.0.270.0140.00516.52
8.0.260.0170.00616.52
8.0.250.0180.00016.61
8.0.240.0130.00516.72
8.0.230.0070.01116.63
8.0.220.0090.00916.75
8.0.210.0120.00616.88
8.0.200.0130.00416.75
8.0.190.0150.00716.63
8.0.180.0130.00516.61
8.0.170.0140.00416.63
8.0.160.0110.00716.63
8.0.150.0110.00916.52
8.0.140.0150.00716.52
8.0.130.0130.00416.52
8.0.120.0130.00616.52
8.0.110.0180.00016.59
8.0.100.0050.01116.63
8.0.90.0090.00916.75
8.0.80.0100.00616.63
8.0.70.0140.00416.60
8.0.60.0210.00016.52
8.0.50.0110.00716.61
8.0.30.0080.01116.52
8.0.20.0150.00616.52
8.0.10.0120.00616.63

preferences:
28.56 ms | 403 KiB | 5 Q