3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface StrategyInterface { public function run(); } class Strategy implements StrategyInterface { protected ?string $value = null; public function __construct(private Closure $closure) { $this->value = (string) rand(1, 100); } public function run() { $this->closure->call($this); } } for ($i = 0; $i < 10; $i++) { $strategy = new Strategy(function() { var_dump($this->value); }); $strategy->run(); }

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.0120.00623.56
8.3.00.0100.01020.68
8.2.140.0120.00622.11
8.2.130.0110.00421.95
8.2.120.0040.01120.65
8.2.110.0110.00420.83
8.2.100.0050.00320.70
8.2.90.0000.00820.74
8.2.80.0090.00921.00
8.2.70.0060.00320.43
8.2.60.0040.00420.51
8.2.50.0040.00420.32
8.2.40.0120.00620.47
8.2.30.0030.00620.55
8.2.20.0080.00020.42
8.2.10.0060.00320.55
8.2.00.0080.00020.50
8.1.270.0120.00623.73
8.1.260.0090.00923.80
8.1.250.0000.00823.79
8.1.240.0030.00620.22
8.1.230.0060.00320.39
8.1.220.0140.00420.77
8.1.210.0040.01520.32
8.1.200.0070.01120.57
8.1.190.0130.00720.34
8.1.180.0130.01020.34
8.1.170.0070.01020.27
8.1.160.0160.00320.18
8.1.150.0000.00920.44
8.1.140.0150.00320.39
8.1.130.0110.00420.42
8.1.120.0120.00620.43
8.1.110.0070.00320.28
8.1.100.0040.00420.41
8.1.90.0030.00620.41
8.1.80.0090.00020.31
8.1.70.0060.00320.38
8.1.60.0060.00320.52
8.1.50.0090.00020.33
8.1.40.0060.00320.35
8.1.30.0040.00420.48
8.1.20.0030.00520.57
8.1.10.0060.00320.52
8.1.00.0040.00420.39

preferences:
29.41 ms | 403 KiB | 5 Q