3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Cache{ protected function put($key,$value){ static $cache = []; var_dump($cache); return $cache[$key] = $value; } } $instance1 = new class extends Cache{ public function store($key,$value) { return $this->put($key,$value); } }; $instance1->store("one",1); $instance1->store("two",2); $instance1->store("three",3); $instance2 = new class extends Cache{ public function store($key,$value) { return $this->put($key,$value); } }; $instance2->store("four",4); $instance2->store("five",5); $instance3 = new class extends Cache{ public function store($key,$value) { return $this->put($key,$value); } }; $instance3->store("six",6); $instance3->store("seven",7);

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.70.0070.00718.43
8.3.60.0070.01416.38
8.3.50.0110.00718.04
8.3.40.0090.00618.68
8.3.30.0040.01118.71
8.3.20.0050.00324.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.190.0120.00316.58
8.2.180.0160.00025.92
8.2.170.0070.01119.14
8.2.160.0000.01522.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00420.69
8.2.110.0000.00920.38
8.2.100.0070.00318.96
8.1.280.0140.00425.92
8.1.270.0000.00823.99
8.1.260.0120.00326.35
8.1.250.0090.00028.09
8.1.240.0000.00820.37
8.1.230.0080.00318.70
8.1.90.0060.00417.43
8.0.220.0080.00116.80
8.0.130.0040.00716.82
7.4.260.0090.00416.49
7.3.330.0040.00416.28

preferences:
18.09 ms | 401 KiB | 5 Q