3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Name implements \Stringable { public function __construct(public readonly string $name) { } public function __toString(): string { return $this->name; } } enum Value: string { case id = 'id'; } function create(\WeakMap $map): \WeakMap { $name = new Name('func'); if (!isset($map[$name])) { $map[$name] = 'func-val'; } echo "In function scope:\n\n"; var_dump($map); echo PHP_EOL; return $map; } $name = new Name('global'); $map = new \WeakMap(); $map[$name] = 'global-val'; $map = create($map); echo "\n"; echo "In global scope:\n\n"; // watch the `Name('func')` key not being present here var_dump($map);

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.140.0070.01116.55
8.3.130.0030.00618.37
8.3.120.0090.00019.18
8.3.110.0060.00320.94
8.3.100.0050.00316.70
8.3.90.0080.00016.65
8.3.50.0070.00316.50
8.2.260.0040.00418.33
8.2.250.0050.00517.02
8.2.240.0030.00617.41
8.2.230.0000.00922.58
8.2.220.0070.00316.75
8.2.210.0040.00416.41
8.2.30.0090.00218.98
8.1.300.0150.00420.09

preferences:
25.57 ms | 403 KiB | 5 Q