3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface Runnable { public function run(string $details): void; } abstract class RunnableBase implements Runnable { public function run(string $more): void { echo $more . "\n"; } } class Impl1 extends RunnableBase { public function run(string $extra): void { parent::run($extra); } } class Impl2 extends RunnableBase { public function run(string $other): void { parent::run($other); } } function getRunnable(): Runnable { if (time() % 2) { return new Impl1(); } else { return new Impl2(); } } $a = getRunnable(); try { // This is the only name that is known at compile time and what I would expect to work. $a->run(details: 'details'); } catch (Throwable $e) { echo $e->getMessage() . "\n"; } try { // I wouldn't expect this to work as it's just an implementation detail. $a->run(more: 'more'); } catch (Throwable $e) { echo $e->getMessage() . "\n"; } try { // I would absolutely never expect this to work, because it is -random-. $a->run(extra: 'extra'); } catch (Throwable $e) { echo $e->getMessage() . "\n"; } try { // I would absolutely never expect this to work, because it is -random-. $a->run(other: 'other'); } catch (Throwable $e) { echo $e->getMessage() . "\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.1.40.0000.00817.51
8.1.30.0210.00417.58
8.1.20.0230.00417.61
8.1.10.0200.00817.58
8.1.00.0240.00317.59
8.0.170.0070.00017.08
8.0.160.0170.00416.79
8.0.150.0190.00316.84
8.0.140.0160.00616.95
8.0.130.0200.00316.93
8.0.120.0150.00716.95
8.0.110.0170.00717.01
8.0.100.0180.00416.85
8.0.90.0230.00016.86
8.0.80.0160.00716.95
8.0.70.0100.01316.88
8.0.60.0120.00516.93
8.0.50.0070.00916.89
8.0.30.0090.00916.97
8.0.20.0090.00917.05
8.0.10.0090.01117.09
8.0.00.0110.00817.02
7.4.280.0070.00216.46
7.4.270.0000.01316.32
7.4.260.0250.00016.36
7.4.250.0180.00016.27
7.4.240.0080.00816.33
7.4.230.0180.00416.34
7.4.220.0190.00316.33
7.4.210.0140.00716.43
7.4.200.0170.00316.49
7.4.190.0130.00816.42
7.4.180.0110.01016.49
7.4.160.0110.00716.42
7.4.150.0100.01016.33
7.4.140.0100.00816.28
7.4.130.0100.00916.29
7.4.120.0110.00816.25
7.4.110.0120.00816.20
7.4.100.0110.00916.27
7.4.90.0100.00916.20
7.4.80.0100.00916.23
7.4.70.0110.00816.27
7.4.60.0100.00916.25
7.4.50.0100.00916.23
7.4.40.0100.00916.22
7.4.30.0110.00816.25
7.4.20.0100.00916.25
7.4.10.0100.00916.23
7.4.00.0090.00816.29
7.3.330.0140.00716.00
7.3.320.0190.00216.03
7.3.310.0170.00416.02
7.3.300.0160.00416.07
7.3.290.0190.00316.25
7.3.280.0080.00816.16
7.3.270.0110.00716.18
7.3.260.0110.00716.13
7.3.250.0100.00916.20
7.3.240.0110.00816.18
7.3.230.0110.00916.16
7.3.220.0100.00916.14
7.3.210.0100.00916.18
7.3.200.0100.01016.17
7.3.190.0100.00816.16
7.3.180.0100.00916.17
7.3.170.0100.00816.17
7.3.160.0110.00816.18
7.3.150.0100.00816.18
7.3.140.0100.00816.16
7.3.130.0100.00816.18
7.3.120.0090.00916.15
7.3.110.0100.00916.15
7.3.100.0100.00916.16
7.3.90.0100.00816.17
7.3.80.0100.00816.16
7.3.70.0100.00916.13
7.3.60.0100.00916.15
7.3.50.0100.00816.11
7.3.40.0100.00816.12
7.3.30.0100.00816.13
7.3.20.0120.00816.23
7.3.10.0140.00816.21
7.3.00.0130.00816.22
7.2.340.0140.01016.17
7.2.330.0110.01016.25
7.2.320.0110.00916.25
7.2.310.0110.00916.24
7.2.300.0120.00816.24
7.2.290.0110.00916.23
7.2.280.0100.00916.28
7.2.270.0110.00816.24
7.2.260.0110.00816.27
7.2.250.0110.00816.26
7.2.240.0110.00916.27
7.2.230.0110.00916.24
7.2.220.0110.00816.24
7.2.210.0120.00916.26
7.2.200.0110.00916.28
7.2.190.0110.00916.26
7.2.180.0110.00916.24
7.2.170.0110.00916.25
7.2.160.0120.00916.25
7.2.150.0120.00916.37
7.2.140.0140.00916.36
7.2.130.0130.00916.38
7.2.120.0130.00816.39
7.2.110.0120.01016.34
7.2.100.0120.00916.37
7.2.90.0110.01016.35
7.2.80.0120.00916.33
7.2.70.0120.00916.35
7.2.60.0130.00816.33
7.2.50.0110.00916.34
7.2.40.0130.00916.38
7.2.30.0120.00916.40
7.2.20.0130.00916.35
7.2.10.0120.00916.33
7.2.00.0120.00916.33

preferences:
15.65 ms | 403 KiB | 5 Q