3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected string $property; public function __construct(string $property) { $this->property = $property; } public function getProperty(): string { return $this->property; } } $foo = new Foo("foo"); echo "Default value:\n"; var_dump($foo->getProperty()); echo "\nInvoking the __constructor() method again:\n"; $foo->__construct("baz"); var_dump($foo->getProperty()); // https://ocramius.github.io/blog/accessing-private-php-class-members-without-reflection/ echo "\nClosure binding:\n"; Closure::bind( function (): void { $this->property = "bang"; }, $foo, $foo )->__invoke(); var_dump($foo->getProperty()); echo "\nAbusing anonymous classes:\n"; $fooAbuser = new class("") extends Foo { public function abuse(Foo $foo): Foo { $foo->property = "boom"; return $foo; } }; var_dump($fooAbuser->abuse($foo)->getProperty());

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.60.0070.00716.50
8.3.50.0060.00916.48
8.3.40.0040.01118.56
8.3.30.0090.00618.61
8.3.20.0040.00420.77
8.3.10.0050.00320.13
8.3.00.0040.00420.91
8.2.180.0070.01118.05
8.2.170.0000.01522.96
8.2.160.0070.00720.48
8.2.150.0070.00224.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0100.00720.85
8.2.110.0030.00621.06
8.2.100.0040.00717.72
8.2.90.0050.00317.75
8.2.80.0050.00318.92
8.2.70.0040.00418.03
8.2.60.0030.00618.22
8.2.50.0030.00619.28
8.2.40.0030.00621.02
8.2.30.0050.00319.14
8.2.20.0040.00418.00
8.2.10.0030.00619.27
8.2.00.0040.00419.17
8.1.280.0110.00325.92
8.1.270.0030.00522.00
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0000.00923.84
8.1.230.0090.00320.80
8.1.220.0000.00917.80
8.1.210.0040.00418.77
8.1.200.0060.00317.25
8.1.190.0030.00617.23
8.1.180.0040.00419.08
8.1.170.0080.00418.47
8.1.160.0040.00418.95
8.1.150.0050.00218.84
8.1.140.0000.00718.92
8.1.130.0030.00320.21
8.1.120.0030.00617.48
8.1.110.0020.00517.52
8.1.100.0000.01017.45
8.1.90.0050.00317.38
8.1.80.0000.01017.40
8.1.70.0040.00417.38
8.1.60.0060.00317.64
8.1.50.0000.00817.53
8.1.40.0050.00317.43
8.1.30.0000.00717.63
8.1.20.0060.00317.69
8.1.10.0020.00517.54
8.1.00.0090.00017.58
8.0.300.0080.00318.77
8.0.290.0000.00816.63
8.0.280.0080.00018.34
8.0.270.0030.00516.98
8.0.260.0030.00320.20
8.0.250.0060.00317.05
8.0.240.0030.00516.99
8.0.230.0000.00717.03
8.0.220.0000.00716.98
8.0.210.0070.00016.89
8.0.200.0060.00017.02
8.0.190.0050.00317.04
8.0.180.0040.00416.99
8.0.170.0050.00517.05
8.0.160.0050.00317.03
8.0.150.0030.00516.89
8.0.140.0000.00716.84
8.0.130.0000.00613.47
8.0.120.0000.00716.83
8.0.110.0000.00716.96
8.0.100.0080.00016.82
8.0.90.0040.00417.04
8.0.80.0050.01116.96
8.0.70.0000.00716.95
8.0.60.0070.00016.89
8.0.50.0030.00517.01
8.0.30.0070.01117.01
8.0.20.0070.01116.86
8.0.10.0040.00416.96
8.0.00.0100.00716.74
7.4.330.0050.00015.55
7.4.320.0030.00316.64
7.4.300.0000.00616.50
7.4.290.0040.00416.52
7.4.280.0050.00316.64
7.4.270.0060.00016.63
7.4.260.0000.00513.24
7.4.250.0040.00416.51
7.4.240.0030.00316.63
7.4.230.0000.00716.61
7.4.220.0030.00316.55
7.4.210.0050.00916.55
7.4.200.0040.00416.73
7.4.130.0080.01016.46
7.4.120.0110.00716.65
7.4.110.0150.00716.48
7.4.100.0110.00916.41
7.4.90.0170.00016.62
7.4.80.0100.01319.39
7.4.70.0130.00316.49
7.4.60.0030.01316.50
7.4.50.0090.00616.61
7.4.40.0140.00416.55
7.4.20.0070.01216.48
7.4.10.0100.00616.46
7.4.00.0050.01116.62
7.3.330.0000.00816.16
7.3.320.0020.00213.07
7.3.310.0030.00616.18
7.3.300.0030.00316.03
7.3.290.0100.00616.16
7.3.280.0030.01016.15
7.3.260.0070.01016.27
7.3.240.0130.00516.22
7.3.230.0070.01016.42
7.3.210.0100.01416.26
7.3.200.0080.00916.28
7.3.190.0180.00416.29
7.3.180.0100.00716.14
7.3.170.0070.01016.26
7.3.160.0080.00716.22
7.3.140.0050.01116.18
7.3.130.0090.01016.09
7.3.120.0130.00416.17
7.3.110.0090.00716.25
7.3.100.0090.00816.21
7.3.90.0110.00916.05
7.3.80.0120.01116.19
7.3.70.0110.01116.20
7.3.60.0070.01016.05
7.3.50.0090.01016.20
7.3.40.0060.01116.09
7.3.30.0080.01316.15
7.3.20.0110.00816.18
7.3.10.0120.00816.13
7.3.00.0150.00816.17
7.2.330.0030.01516.11
7.2.320.0070.01416.16
7.2.310.0080.00916.10
7.2.300.0130.00916.42
7.2.290.0030.01316.20
7.2.270.0050.01116.29
7.2.260.0080.01016.29
7.2.250.0060.01116.16
7.2.240.0130.00716.28
7.2.230.0120.00816.24
7.2.220.0130.00816.26
7.2.210.0060.01616.24
7.2.200.0130.00916.34
7.2.190.0100.00816.17
7.2.180.0100.01116.35
7.2.170.0160.00816.33
7.2.160.0090.01016.24
7.2.150.0130.01016.46
7.2.140.0140.00816.32
7.2.130.0100.01016.21
7.2.120.0070.01116.40
7.2.110.0140.00516.20
7.2.100.0070.01316.26
7.2.90.0150.00516.40
7.2.80.0130.00816.19
7.2.70.0130.01116.33
7.2.60.0090.01316.29
7.2.50.0080.01216.34
7.2.40.0130.00516.32
7.2.30.0080.01416.44
7.2.20.0100.01216.38
7.2.10.0050.01516.27
7.2.00.0100.01016.08

preferences:
37.28 ms | 400 KiB | 5 Q