3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $id; public $handle; public function __construct($id) { $this->id = $id; $this->handle = fopen('php://memory', 'r+'); echo $this->id . ' - construct' . PHP_EOL; } public function __destruct() { echo $this->id . ' - destruct' . PHP_EOL; fclose($this->handle); } public function bar() { echo $this->id . ' - bar - ' . get_resource_type($this->handle) . PHP_EOL; return $this; } public static function create($id) { return new Foo($id); } } $foo = Foo::create(1); var_dump( $foo->bar()->handle ); var_dump( Foo::create(2)->bar()->handle );

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.5.10.0100.00920.25
8.5.00.0130.00919.99
8.4.150.0060.00616.88
8.4.140.0130.00917.67
8.4.130.0100.01118.91
8.4.120.0120.00523.83
8.4.110.0110.01020.56
8.4.100.0120.00917.74
8.4.90.0110.01018.75
8.4.80.0150.00519.38
8.4.70.0130.00718.05
8.4.60.0130.00718.95
8.4.50.0100.00820.24
8.4.40.0120.00817.73
8.4.30.0070.01317.72
8.4.20.0030.01617.60
8.4.10.0170.00317.52
8.3.280.0090.01118.36
8.3.270.0090.01016.57
8.3.260.0130.00616.54
8.3.250.0110.00718.98
8.3.240.0110.00817.10
8.3.230.0060.00516.59
8.3.220.0110.00816.96
8.3.210.0120.00716.64
8.3.200.0040.00416.38
8.3.190.0040.00417.07
8.3.180.0090.01018.38
8.3.170.0150.00317.21
8.3.160.0090.00918.22
8.3.150.0110.00718.77
8.3.140.0060.00317.33
8.3.130.0030.01618.43
8.3.120.0030.00620.74
8.3.110.0030.00916.64
8.3.100.0100.01016.42
8.3.90.0050.00326.77
8.3.80.0030.00618.30
8.3.70.0110.00718.33
8.3.60.0120.00616.37
8.3.50.0140.00922.06
8.3.40.0070.01118.67
8.3.30.0090.00619.09
8.3.20.0040.00420.10
8.3.10.0080.00021.80
8.3.00.0080.00019.79
8.2.290.0130.00620.51
8.2.280.0110.01022.45
8.2.270.0080.00619.02
8.2.260.0110.00416.59
8.2.250.0150.00618.45
8.2.240.0030.01417.07
8.2.230.0040.00420.94
8.2.220.0080.00024.06
8.2.210.0080.00026.77
8.2.200.0060.00316.88
8.2.190.0150.00416.75
8.2.180.0130.00725.92
8.2.170.0030.01222.96
8.2.160.0060.00920.52
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0150.00326.16
8.2.120.0060.00320.94
8.2.110.0000.00922.25
8.2.100.0080.00417.78
8.2.90.0050.00317.50
8.2.80.0040.00418.78
8.2.70.0000.00719.25
8.2.60.0030.00617.63
8.2.50.0000.00817.63
8.2.40.0000.00817.62
8.2.30.0080.00019.27
8.2.20.0050.00317.61
8.2.10.0050.00217.95
8.2.00.0000.00817.68
8.1.330.0110.00821.53
8.1.320.0080.01116.11
8.1.310.0070.00718.17
8.1.300.0090.00018.41
8.1.290.0060.00330.84
8.1.280.0140.00725.92
8.1.270.0040.00424.66
8.1.260.0060.00326.35
8.1.250.0000.00828.09
8.1.240.0000.01222.13
8.1.230.0080.00420.71
8.1.220.0080.00017.74
8.1.210.0000.00818.77
8.1.200.0100.00017.38
8.1.190.0000.00817.23
8.1.180.0040.00418.10
8.1.170.0000.00817.62
8.1.160.0000.00718.90
8.1.150.0000.00820.11
8.1.140.0090.00017.45
8.1.130.0030.00317.69
8.1.120.0000.00717.38
8.1.110.0000.00717.46
8.1.100.0040.00417.30
8.1.90.0000.00717.53
8.1.80.0070.00017.52
8.1.70.0030.00517.40
8.1.60.0060.00317.61
8.1.50.0000.00817.51
8.1.40.0030.00517.45
8.1.30.0050.00317.58
8.1.20.0000.00817.68
8.1.10.0020.00517.63
8.1.00.0000.00717.41
8.0.300.0040.00418.77
8.0.290.0070.00016.75
8.0.280.0000.00718.43
8.0.270.0000.00717.33
8.0.260.0000.00617.22
8.0.250.0030.00517.10
8.0.240.0000.00716.99
8.0.230.0030.00316.94
8.0.220.0040.00416.97
8.0.210.0000.00816.95
8.0.200.0040.00416.95
8.0.190.0040.00416.92
8.0.180.0000.00816.98
8.0.170.0040.00417.01
8.0.160.0000.00816.83
8.0.150.0030.00516.94
8.0.140.0040.00416.87
8.0.130.0050.00013.43
8.0.120.0060.00316.84
8.0.110.0000.00717.05
8.0.100.0000.00816.91
8.0.90.0030.00517.00
8.0.80.0060.00916.94
8.0.70.0040.00416.96
8.0.60.0000.00916.78
8.0.50.0000.00816.96
8.0.30.0090.01017.19
8.0.20.0090.01417.40
8.0.10.0040.00416.77
8.0.00.0120.01016.90
7.4.330.0000.00515.19
7.4.320.0030.00316.50
7.4.300.0000.00616.50
7.4.290.0000.00716.62
7.4.280.0000.00816.50
7.4.270.0000.00716.53
7.4.260.0060.00016.56
7.4.250.0000.00716.38
7.4.240.0020.00516.54
7.4.230.0000.00716.36
7.4.220.0060.01316.66
7.4.210.0070.00716.50
7.4.200.0000.00716.64
7.4.160.0060.01016.64
7.4.150.0100.01017.40
7.4.140.0090.01117.86
7.4.130.0120.00616.61
7.4.120.0140.00716.58
7.4.110.0000.01916.46
7.4.100.0130.00316.51
7.4.90.0060.01116.64
7.4.80.0110.01119.39
7.4.70.0100.01316.31
7.4.60.0060.01016.39
7.4.50.0030.00316.58
7.4.40.0090.00916.48
7.4.30.0090.00616.59
7.4.00.0040.01114.71
7.3.330.0030.00313.39
7.3.320.0000.00513.39
7.3.310.0000.00716.41
7.3.300.0030.00316.38
7.3.290.0070.00016.24
7.3.280.0110.00716.37
7.3.270.0120.01217.40
7.3.260.0030.01516.70
7.3.250.0090.00916.59
7.3.240.0040.01216.46
7.3.230.0110.00416.64
7.3.210.0130.01016.42
7.3.200.0130.01019.39
7.3.190.0100.00716.43
7.3.180.0030.01416.60
7.3.170.0030.01316.39
7.3.160.0080.00816.38
7.2.330.0120.01216.71
7.2.320.0120.00416.86
7.2.310.0070.01116.78
7.2.300.0100.01316.71
7.2.290.0060.00916.52
7.2.60.0000.01316.69
7.2.00.0030.01319.48
7.1.200.0110.00415.63
7.1.100.0070.00718.08
7.1.70.0000.01017.19
7.1.60.0070.01719.29
7.1.50.0130.01016.92
7.1.00.0070.07322.44
7.0.200.0030.00716.83
7.0.140.0000.03722.21
7.0.100.0130.03020.04
7.0.90.0000.05019.91
7.0.80.0070.04720.00
7.0.70.0070.03719.92
7.0.60.0030.04019.89
7.0.50.0030.04320.37
7.0.40.0070.05320.13
7.0.30.0000.04720.01
7.0.20.0070.07320.06
7.0.10.0100.07320.11
7.0.00.0100.07719.94
5.6.280.0030.07021.13
5.6.250.0030.04020.70
5.6.240.0000.04720.62
5.6.230.0000.04720.57
5.6.220.0030.05320.71
5.6.210.0000.07020.50
5.6.200.0000.04721.18
5.6.190.0000.07021.07
5.6.180.0070.04020.97
5.6.170.0000.04321.04
5.6.160.0070.07721.08
5.6.150.0030.04321.12
5.6.140.0100.07720.95
5.6.130.0000.09021.07
5.6.120.0030.08721.07
5.6.110.0030.08021.05
5.6.100.0030.09321.03
5.6.90.0070.06321.02
5.6.80.0030.08020.49
5.6.70.0070.07320.42
5.6.60.0100.07720.32
5.6.50.0170.06320.57
5.6.40.0030.08320.44
5.6.30.0000.07320.40
5.6.20.0130.07320.41
5.6.10.0170.07720.37
5.6.00.0130.07320.37
5.5.380.0030.04320.36
5.5.370.0030.04020.43
5.5.360.0000.05020.54
5.5.350.0170.05020.46
5.5.340.0070.03720.90
5.5.330.0100.06020.92
5.5.320.0000.05020.93
5.5.310.0030.08320.89
5.5.300.0130.07720.84
5.5.290.0100.07720.73
5.5.280.0100.07320.91
5.5.270.0030.08720.73
5.5.260.0000.04720.89
5.5.250.0070.08320.66
5.5.240.0070.08020.15
5.5.230.0100.07720.02
5.5.220.0030.04020.24
5.5.210.0070.08320.12
5.5.200.0000.09020.14
5.5.190.0100.04320.25
5.5.180.0130.07320.09
5.5.160.0100.07320.22
5.5.150.0100.07320.18
5.5.140.0030.07720.11
5.5.130.0100.04320.18
5.5.120.0100.07020.11
5.5.110.0100.04320.08
5.5.100.0130.06720.02
5.5.90.0070.08020.07
5.5.80.0030.07720.09
5.5.70.0130.07320.17
5.5.60.0070.07020.00
5.5.50.0030.07020.07
5.5.40.0070.08020.09
5.5.30.0170.07020.14
5.5.20.0070.04320.07
5.5.10.0100.08020.14
5.5.00.0170.06320.04
5.4.450.0070.07719.15
5.4.440.0000.04319.21
5.4.430.0030.06019.46
5.4.420.0130.07319.27
5.4.410.0030.07719.43
5.4.400.0070.04318.91
5.4.390.0070.07718.85
5.4.380.0100.07719.14
5.4.370.0130.06718.88
5.4.360.0030.07019.18
5.4.350.0100.07319.13
5.4.340.0100.07719.16
5.4.320.0170.06719.21
5.4.310.0070.03719.03
5.4.300.0030.05019.25
5.4.290.0170.07018.95
5.4.280.0030.07719.21
5.4.270.0170.06719.14
5.4.260.0100.07019.14
5.4.250.0100.05019.23
5.4.240.0030.05019.12
5.4.230.0030.07719.11
5.4.220.0100.04719.04
5.4.210.0130.05319.23
5.4.200.0070.07719.16
5.4.190.0030.07319.02
5.4.180.0070.06319.04
5.4.170.0130.06719.04
5.4.160.0100.07719.09
5.4.150.0000.06719.18
5.4.140.0030.08316.35
5.4.130.0070.07316.36
5.4.120.0070.07016.36
5.4.110.0030.04316.36
5.4.100.0070.07016.36
5.4.90.0070.04316.47
5.4.80.0070.07016.46
5.4.70.0100.06316.41
5.4.60.0100.05316.38
5.4.50.0100.07316.46
5.4.40.0100.05316.37
5.4.30.0100.07016.46
5.4.20.0100.07016.48
5.4.10.0100.06316.36
5.4.00.0100.06315.64
5.3.290.0070.07314.60
5.3.280.0100.06714.58
5.3.270.0070.05714.68
5.3.260.0030.05014.59
5.3.250.0070.07314.71
5.3.240.0170.06314.68
5.3.230.0030.07714.67
5.3.220.0100.07014.51
5.3.210.0070.06314.50
5.3.200.0070.07714.60
5.3.190.0030.06714.64
5.3.180.0100.07714.50
5.3.170.0170.06314.61
5.3.160.0070.07014.55
5.3.150.0100.07014.69
5.3.140.0000.07314.66
5.3.130.0030.08014.59
5.3.120.0070.07314.49
5.3.110.0070.06314.68
5.3.100.0030.06014.05
5.3.90.0100.06314.07
5.3.80.0030.06314.15
5.3.70.0030.07014.02
5.3.60.0070.06314.02
5.3.50.0000.07013.95
5.3.40.0130.07314.07
5.3.30.0130.06013.98
5.3.20.0030.07713.72
5.3.10.0070.07013.79
5.3.00.0100.07013.74
5.2.170.0070.05711.06
5.2.160.0130.05011.18
5.2.150.0000.06311.23
5.2.140.0070.06311.17
5.2.130.0030.06711.21
5.2.120.0070.06011.00
5.2.110.0130.02711.13
5.2.100.0070.06011.23
5.2.90.0030.05711.23
5.2.80.0070.06311.13
5.2.70.0130.05311.14
5.2.60.0070.06311.08
5.2.50.0100.05311.16
5.2.40.0100.03011.10
5.2.30.0100.06011.01
5.2.20.0100.06010.86
5.2.10.0100.05310.96
5.2.00.0000.04310.75
5.1.60.0030.05310.10
5.1.50.0070.05010.13
5.1.40.0000.03710.10
5.1.30.0200.03310.48
5.1.20.0070.05710.30
5.1.10.0000.06310.15
5.1.00.0000.03710.10
5.0.50.0070.04310.10
5.0.40.0000.04310.10
5.0.30.0030.06310.10
5.0.20.0000.04310.10
5.0.10.0000.04710.10
5.0.00.0000.04010.10
4.4.90.0030.02310.10
4.4.80.0000.03710.10
4.4.70.0030.03710.10
4.4.60.0000.03710.10
4.4.50.0070.02310.10
4.4.40.0070.05010.10
4.4.30.0000.03310.10
4.4.20.0070.01710.10
4.4.10.0070.03310.10
4.4.00.0030.05710.10
4.3.110.0100.03010.10
4.3.100.0000.03710.10
4.3.90.0070.03010.10
4.3.80.0000.05310.10
4.3.70.0070.03010.10
4.3.60.0100.02710.10
4.3.50.0030.03310.10
4.3.40.0030.05010.10
4.3.30.0000.02010.10
4.3.20.0000.03310.10
4.3.10.0030.03710.10
4.3.00.0030.01710.10

preferences:
39.34 ms | 403 KiB | 5 Q