3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class SomeImmutableObject { private $someString; private $flagCreate = false; public function __construct(string $value) { if ($this->flagCreate === true) { throw new \BadMethodCallException('This is an immutable object has already create.'); } $this->someString = $value; $this->flagCreate = true; } public function getValue(): string { return 'the value is:' . $this->someString . ' - '; } } class TryToBreakImmutableObject extends SomeImmutableObject { public $someString; public function __construct(string $value) { $this->someString = $value; } public function getValue(): string { return 'the value is:' . $this->someString . ' - '; } public function change(): void { $this->someString .= ' and Minny'; } } $four = new TryToBreakImmutableObject('Pippo'); echo $four->getValue(); //Pippo echo $four->change(); echo $four->getValue();

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)
7.4.30.0120.00316.29
7.4.20.0100.00616.28
7.4.10.0120.00316.32
7.4.00.0090.01216.47
7.3.150.0100.00916.27
7.3.140.0030.01616.13
7.3.130.0100.01016.29
7.3.120.0100.01016.18
7.3.110.0070.01315.96
7.3.100.0120.00616.00
7.3.90.0170.00016.19
7.3.80.0100.01316.29
7.3.70.0110.01116.13
7.3.60.0090.01216.20
7.3.50.0080.00816.31
7.3.40.0160.00016.40
7.3.30.0040.01816.37
7.3.20.0120.00316.11
7.3.10.0130.01016.34
7.3.00.0110.01116.26
7.2.280.0070.01016.40
7.2.270.0130.00316.59
7.2.260.0090.01216.30
7.2.250.0180.00316.22
7.2.240.0060.01016.14
7.2.230.0110.01116.53
7.2.220.0100.01416.31
7.2.210.0040.01416.42
7.2.200.0060.01716.54
7.2.190.0100.00716.48
7.2.180.0030.01416.25
7.2.170.0160.00616.27
7.2.160.0030.01216.38
7.2.150.0100.01316.48
7.2.140.0090.01516.51
7.2.130.0130.01016.33
7.2.120.0120.01216.34
7.2.110.0090.01416.18
7.2.100.0090.01416.35
7.2.90.0120.01216.19
7.2.80.0140.00916.21
7.2.70.0220.00616.39
7.2.60.0030.01716.53
7.2.50.0100.00816.22
7.2.40.0120.00916.44
7.2.30.0150.00916.28
7.2.20.0040.01116.21
7.2.10.0060.00916.30
7.2.00.0110.01216.49

preferences:
147.98 ms | 939 KiB | 8 Q