3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Point { public readonly string $name; public function __construct( public readonly int $x, public readonly int $y, ) {} public function setName(string $name): static { $this->name ??= $name; return $this; } } $p = new Point(3, 4); $p->setName('Larry'); var_dump($p); $rClass = new \ReflectionClass(Point::class); $new = $rClass->newInstanceWithoutConstructor(); $setter = (fn (string $k, mixed $v) => $this->$k = $v)->bindTo($new, $new); $setter('x', 3); $setter('y', 4); $setter('name', 'Larry'); var_dump($new);

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.130.0140.00717.66
8.4.120.0110.00920.59
8.4.110.0120.00822.39
8.4.100.0030.00617.76
8.4.90.0120.00917.86
8.4.80.0070.00717.81
8.4.70.0140.00718.04
8.4.60.0070.00518.61
8.4.50.0070.00217.66
8.4.40.0070.00317.59
8.4.30.0130.00620.54
8.4.20.0070.01319.48
8.4.10.0080.00019.57
8.3.260.0140.00616.48
8.3.250.0050.00218.97
8.3.240.0100.01116.78
8.3.230.0070.01216.85
8.3.220.0110.00717.08
8.3.210.0090.00916.56
8.3.200.0080.01116.50
8.3.190.0090.01117.04
8.3.180.0140.00616.57
8.3.170.0040.00516.89
8.3.160.0110.00718.96
8.3.150.0030.01617.02
8.3.140.0060.01016.55
8.3.130.0080.00018.61
8.3.120.0110.00418.11
8.3.110.0090.00618.29
8.3.50.0130.00618.18
8.2.290.0100.00820.51
8.2.280.0040.00618.48
8.2.270.0150.00416.52
8.2.260.0040.00418.82
8.2.250.0030.00616.71
8.2.240.0040.01118.17
8.2.230.0040.00418.45
8.1.330.0100.01020.47
8.1.320.0120.00816.18
8.1.310.0110.00716.82
8.1.300.0120.00618.10
8.0.120.0120.00013.39
8.0.110.0040.00813.36
8.0.100.0100.00313.46
8.0.90.0040.00413.45
8.0.80.0070.00213.36
8.0.70.0070.00313.27
8.0.60.0030.00513.43
8.0.50.0050.00413.43
8.0.30.0060.00213.33
8.0.20.0060.00213.51
8.0.10.0040.00813.44
8.0.00.0030.00313.46
7.4.250.0000.00513.16
7.4.240.0150.00013.28
7.4.230.0100.00413.15
7.4.220.0090.00313.26
7.4.210.0040.00913.15
7.4.200.0130.00013.26
7.4.190.0130.00013.16
7.4.180.0090.00313.32
7.4.160.0050.00513.32
7.4.150.0130.00013.26
7.4.140.0050.00713.07
7.4.130.0090.00312.94
7.4.120.0030.00613.11
7.4.110.0080.00413.13
7.4.100.0130.00013.15
7.4.90.0080.00413.11
7.4.80.0090.00313.03
7.4.70.0050.00813.01
7.4.60.0060.00613.13
7.4.50.0080.00413.01
7.4.40.0040.00913.02
7.4.30.0090.00413.16
7.4.20.0080.00413.02
7.4.10.0000.00613.02
7.4.00.0100.00313.17
7.3.320.0050.00813.20
7.3.310.0040.00913.06
7.3.300.0120.00013.14
7.3.290.0130.00013.23
7.3.280.0150.00013.02
7.3.270.0100.00513.10
7.3.260.0050.01013.22
7.3.250.0110.00413.14
7.3.240.0090.00513.20
7.3.230.0060.00713.10
7.3.220.0120.00012.84
7.3.210.0000.01213.12
7.3.200.0090.00312.84
7.3.190.0110.00213.12
7.3.180.0130.00012.99
7.3.170.0130.00013.04
7.3.160.0100.00313.07
7.3.150.0080.00612.95
7.3.140.0120.00013.15
7.3.130.0070.00312.84
7.3.120.0080.00013.04
7.3.110.0030.00312.85
7.3.100.0080.00012.81
7.3.90.0020.00513.28
7.3.80.0090.00313.09
7.3.70.0070.00012.91
7.3.60.0000.00613.12
7.3.50.0030.00313.13
7.3.40.0050.00013.26
7.3.30.0030.00313.05
7.3.20.0060.00015.03
7.3.10.0000.00514.81
7.3.00.0030.00314.98

preferences:
47.22 ms | 403 KiB | 5 Q