3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait CalculatesArea { private $pi = 3.1416; private function rectangularArea(): float { return $this->a * $this->b; } private function ellipticArea(): float { return $this->a * $this->b * $this->pi; } } abstract class Shape { use CalculatesArea; public function __construct(protected float $a, protected float $b) {} public function area(): ?float { if ($this instanceof Rectangle) { return $this->rectangularArea(); } if ($this instanceof Ellipse) { return $this->ellipticArea(); } return null; } } class Rectangle extends Shape {} class Ellipse extends Shape {} var_dump( (new Rectangle(3, 4))->area(), (new Ellipse(1.3, 3.8))->area(), );

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.140.0130.00917.81
8.4.130.0090.01117.77
8.4.120.0060.00320.68
8.4.110.0100.01020.48
8.4.100.0110.00818.06
8.4.90.0140.00617.78
8.4.80.0040.00420.76
8.4.70.0090.01117.80
8.4.60.0110.01017.67
8.4.50.0120.00819.46
8.4.40.0130.00619.60
8.4.30.0100.01020.42
8.4.20.0140.00719.87
8.4.10.0030.00723.83
8.3.270.0140.00516.63
8.3.260.0040.00516.71
8.3.250.0110.00719.07
8.3.240.0120.00916.62
8.3.230.0040.00616.86
8.3.220.0050.00217.37
8.3.210.0110.00916.86
8.3.200.0120.01018.92
8.3.190.0070.01116.46
8.3.180.0100.00918.59
8.3.170.0120.00619.08
8.3.160.0110.00717.43
8.3.150.0090.00918.91
8.3.140.0150.00320.73
8.3.130.0040.00416.82
8.3.120.0040.00419.16
8.3.110.0030.00620.94
8.3.100.0040.00416.76
8.3.90.0000.00826.77
8.3.80.0000.01018.55
8.3.70.0090.00916.60
8.3.60.0110.00316.75
8.3.50.0040.01118.35
8.3.40.0060.00820.09
8.3.30.0140.00018.75
8.3.20.0040.00424.18
8.3.10.0080.00024.66
8.3.00.0070.00026.16
8.2.290.0080.00320.47
8.2.280.0090.01018.29
8.2.270.0040.01516.49
8.2.260.0040.00417.13
8.2.250.0080.00016.64
8.2.240.0160.00018.78
8.2.230.0090.00022.58
8.2.220.0130.00324.06
8.2.210.0080.00026.77
8.2.200.0060.00318.54
8.2.190.0070.01118.30
8.2.180.0110.00425.92
8.2.170.0070.00718.95
8.2.160.0100.00322.96
8.2.150.0040.00425.66
8.2.140.0050.00324.66
8.2.130.0050.00226.16
8.2.120.0040.00419.36
8.2.110.0080.00320.35
8.2.100.0030.00720.32
8.2.00.0060.00319.40
8.1.330.0040.00522.02
8.1.320.0110.00716.27
8.1.310.0100.00716.39
8.1.300.0060.00319.60
8.1.290.0050.00530.84
8.1.280.0070.00725.92
8.1.270.0050.00324.66
8.1.260.0080.01226.35
8.1.250.0080.00028.09
8.1.240.0030.00718.52
8.1.230.0070.00318.33

preferences:
69.7 ms | 403 KiB | 5 Q