3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface StrategyInterface { public function run(); } class Strategy implements StrategyInterface { protected ?string $value = null; private static $counter = 0; public function __construct(private Closure $closure) { echo "Strategy Counter: ", ++self::$counter, PHP_EOL; $this->value = (string)rand(1, 100); } public function run() { $this->closure->call($this); } public function __destruct() { echo "Strategy Counter: ", --self::$counter, PHP_EOL; } } $strategy1 = new Strategy(function () { var_dump($this->value); }); $strategy2 = new Strategy(function () { var_dump($this->value); }); $strategy3 = new Strategy(function () { var_dump($this->value); }); $strategy1->run(); $strategy1 = null; $strategy2->run(); unset($strategy2); $strategy3->run(); $strategy4 = new Strategy(function () { var_dump($this->value); });

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.10.0060.01223.48
8.3.00.0000.01720.71
8.2.140.0060.00921.93
8.2.130.0100.01022.29
8.2.120.0120.00920.75
8.2.110.0130.00720.82
8.2.100.0130.00720.74
8.2.90.0110.00820.69
8.2.80.0150.00320.73
8.2.70.0070.01120.45
8.2.60.0130.00320.45
8.2.50.0090.01220.45
8.2.40.0120.00620.57
8.2.30.0130.00620.41
8.2.20.0100.01020.60
8.2.10.0140.00720.56
8.2.00.0170.00320.55
8.1.270.0170.00321.92
8.1.260.0170.00323.79
8.1.250.0030.01623.79
8.1.240.0160.00320.41
8.1.230.0070.00320.29
8.1.220.0000.00820.83
8.1.210.0130.00320.32
8.1.200.0160.00020.66
8.1.190.0110.00420.46
8.1.180.0040.01120.20
8.1.170.0090.00620.45
8.1.160.0030.01020.26
8.1.150.0060.00320.16
8.1.140.0080.00020.35
8.1.130.0040.00420.65
8.1.120.0060.00320.45
8.1.110.0030.00620.29
8.1.100.0120.00620.38
8.1.90.0110.00420.32
8.1.80.0040.00420.34
8.1.70.0120.00320.46
8.1.60.0040.01120.46
8.1.50.0090.00620.32
8.1.40.0080.00020.50
8.1.30.0060.00320.50
8.1.20.0050.00520.52
8.1.10.0030.00520.52
8.1.00.0080.00020.35

preferences:
27.59 ms | 403 KiB | 5 Q