3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function __construct(public readonly string $name) {} } class FancyArray { public function __construct(public readonly array $array = []) {} public function addElement(mixed $element): self { if (false === $element instanceof Foo) { throw new Exception("GOVNYAK!!!"); } return new self(array_merge($this->array, [$element])); } public function removeElementByIndex(mixed $index): self { return new self(array_splice(...[$this->array, $index, 1])); } } $array = new FancyArray([new Foo('a'), new Foo('b')]); $modifiedArray = $array->removeElementByIndex(1) ->addElement(new Foo('c')) ->addElement(new Foo('d')); var_dump($array); var_dump($modifiedArray);

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.120.0060.00317.71
8.4.110.0100.01019.29
8.4.100.0090.01217.82
8.4.90.0150.00520.55
8.4.80.0090.01118.91
8.4.70.0070.00917.90
8.4.60.0170.00517.86
8.4.50.0130.00818.50
8.4.40.0100.01017.78
8.4.30.0040.00419.06
8.4.20.0160.00317.95
8.4.10.0050.00519.38
8.3.250.0100.00818.84
8.3.240.0110.00916.58
8.3.230.0050.00316.63
8.3.220.0110.00718.95
8.3.210.0120.00416.39
8.3.200.0080.01116.33
8.3.190.0060.01419.13
8.3.180.0110.00816.51
8.3.170.0000.02020.46
8.3.160.0130.00716.56
8.3.150.0070.01317.39
8.3.140.0070.01118.61
8.3.130.0070.00318.43
8.3.120.0080.00418.73
8.3.110.0130.00622.58
8.3.100.0060.00322.58
8.3.90.0040.01122.58
8.3.50.0080.00022.58
8.3.00.0100.01028.09
8.2.290.0060.00316.51
8.2.280.0110.00816.99
8.2.270.0070.01117.22
8.2.260.0070.01116.63
8.2.250.0080.00016.39
8.2.240.0040.00418.84
8.2.230.0000.00922.58
8.2.220.0070.00322.58
8.2.210.0040.00422.58
8.2.130.0130.00728.09
8.2.120.0160.00328.09
8.2.110.0140.00728.09
8.2.100.0200.00028.09
8.2.90.0130.00628.09
8.2.80.0100.01028.09
8.2.70.0130.00628.09
8.2.60.0080.01228.09
8.2.50.0070.01128.09
8.2.40.0090.00928.09
8.2.30.0070.01428.09
8.2.20.0070.01128.09
8.2.10.0110.01128.09
8.2.00.0120.00328.09
8.1.330.0110.00816.30
8.1.320.0100.00916.32
8.1.310.0120.00316.33
8.1.300.0100.01020.03
8.1.260.0160.00428.09
8.1.250.0100.01028.09
8.1.240.0130.00328.09
8.1.230.0130.00728.09
8.1.220.0170.00328.09
8.1.210.0060.01028.09
8.1.200.0060.00928.09
8.1.190.0080.00828.09
8.1.180.0060.00328.09
8.1.170.0050.00328.09
8.1.160.0030.00528.09
8.1.150.0060.00328.09
8.1.140.0040.00428.09
8.1.130.0040.01128.09
8.1.120.0060.00328.09
8.1.110.0030.00528.09
8.1.100.0050.00328.09
8.1.90.0000.01828.09
8.1.80.0080.00828.09
8.1.70.0080.00028.09
8.1.60.0040.00428.09
8.1.50.0030.00628.09
8.1.40.0050.00328.09
8.1.30.0080.00028.09
8.1.20.0050.00328.09
8.1.10.0040.00428.09
8.1.00.0040.00428.09

preferences:
26.89 ms | 403 KiB | 5 Q