3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Immutable { public function __construct(/** @psalm-readonly */ public stdClass $neverChange) {} public function mutate(): void { $this->neverChange->foo = 1; } } class DoOtherStuff { public function doStuff(Immutable $immutable): void { $immutable->mutate(); } } $data = new stdClass; $data->foo = 0; $immutable = new Immutable($data); /* ... */ if ($immutable->neverChange->foo === 0) { /* ... */ (new DoOtherStuff())->doStuff($immutable); /* Here I would assume, that my immutable object still holds the not change value stdClass::foo = 0 but it got mutated to stdClass::foo = 1 */ } echo "Does this code actually run without any syntax errors? " . ($immutable->neverChange->foo ? 'Me definetly think so...' : 'No, some internet rando was smarter than me rapid typing some example which everybody did understand anyways');

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.130.0060.00318.44
8.3.120.0160.00318.62
8.3.110.0160.00316.50
8.3.100.0030.00618.43
8.3.90.0100.01018.43
8.3.80.0040.00418.56
8.3.70.0100.00518.56
8.3.60.0040.01418.31
8.3.50.0120.00616.47
8.3.40.0070.00722.14
8.3.30.0140.00020.22
8.3.20.0050.00324.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.240.0080.01117.30
8.2.230.0070.00720.94
8.2.220.0080.00024.06
8.2.210.0000.01026.77
8.2.200.0040.00418.25
8.2.190.0120.00616.75
8.2.180.0090.00618.04
8.2.170.0130.00618.96
8.2.160.0120.00322.96
8.2.150.0040.00425.66
8.2.140.0000.00824.66
8.2.130.0000.00826.16
8.2.120.0000.00819.66
8.2.110.0070.00320.22
8.2.100.0060.00320.38
8.2.70.0030.00717.80
8.1.300.0040.00418.48
8.1.290.0030.00618.88
8.1.280.0070.00725.92
8.1.270.0080.00024.66
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0060.00318.95
8.1.230.0030.00622.15

preferences:
38.05 ms | 403 KiB | 5 Q