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 immutable object has already been created.'); } $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 Baz'; } } $four = new TryToBreakImmutableObject('Foo'); echo $four->getValue(); //Foo 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.80.0090.00919.39
7.4.70.0140.00419.39
7.4.60.0080.00819.39
7.4.50.0090.00619.39
7.4.40.0150.00219.39
7.4.30.0080.00819.39
7.4.20.0110.00819.39
7.4.10.0100.01019.39
7.4.00.0130.00319.39
7.3.200.0110.00619.39
7.3.190.0050.01019.39
7.3.180.0050.01119.39
7.3.170.0060.01219.39
7.3.160.0080.01019.39
7.3.150.0070.01119.39
7.3.140.0070.01619.39
7.3.130.0050.01419.39
7.3.120.0040.01219.39
7.3.110.0030.01319.39
7.3.100.0150.01119.39
7.3.90.0140.00319.39
7.3.80.0120.00619.39
7.3.70.0130.00619.39
7.3.60.0090.01519.39
7.3.50.0100.01019.39
7.3.40.0090.01419.39
7.3.30.0050.01319.39
7.3.20.0130.00719.39
7.3.10.0080.00819.39
7.3.00.0130.00419.39
7.2.320.0030.01519.39
7.2.310.0130.00319.39
7.2.300.0090.00919.39
7.2.290.0110.00619.39
7.2.280.0060.01619.39
7.2.270.0090.01319.39
7.2.260.0100.00619.39
7.2.250.0100.00719.39
7.2.240.0090.01319.39
7.2.230.0160.00819.39
7.2.220.0040.01519.39
7.2.210.0140.00519.39
7.2.200.0090.00919.39
7.2.190.0040.01819.39
7.2.180.0180.00419.39
7.2.170.0140.00219.39
7.2.160.0030.01419.39
7.2.150.0090.00819.39
7.2.140.1250.01319.39
7.2.130.0140.00719.39
7.2.120.0060.01419.39
7.2.110.0080.01119.39
7.2.100.0120.00619.39
7.2.90.0110.00819.39
7.2.80.0160.01019.39
7.2.70.0200.00419.39
7.2.60.0030.01719.39
7.2.50.0090.00919.39
7.2.40.0050.01419.39
7.2.30.0040.01519.39
7.2.20.0160.00519.39
7.2.10.0050.01419.39
7.2.00.0050.01319.39

preferences:
141.12 ms | 1440 KiB | 7 Q