3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Item { private $cost = 100; public function getTotal($discount = 7) { return $this->cost * $discount/(100+$discount); } } class AccesserToPrivated { public function getPrivate($obj, $attribute) { $getter = function() use ($attribute) {return $this->$attribute;}; return \Closure::bind($getter, $obj, get_class($obj)); } public function setPrivate($obj, $attribute) { $setter = function($value) use ($attribute) {$this->$attribute = $value;}; return \Closure::bind($setter, $obj, get_class($obj)); } } $obj = new Item(); $accesser = new AccesserToPrivated(); $getFoo = $accesser->getPrivate($obj, 'cost'); $setFoo = $accesser->setPrivate($obj, 'cost'); echo $obj->getTotal() . PHP_EOL; echo $obj->getFoo(); $setFoo(1); echo $obj->getTotal() . PHP_EOL; echo $obj->getFoo();

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.0140.00716.75
8.3.50.0100.01021.13
8.3.40.0090.00618.56
8.3.30.0140.00018.70
8.3.20.0000.00720.34
8.3.10.0000.00721.98
8.3.00.0040.00423.48
8.2.180.0070.01116.75
8.2.170.0080.00622.96
8.2.160.0060.00919.51
8.2.150.0040.00424.18
8.2.140.0050.00224.66
8.2.130.0000.00820.93
8.2.120.0080.00026.35
8.2.110.0060.00319.19
8.2.100.0080.00417.93
8.2.90.0090.00019.08
8.2.80.0050.00317.97
8.2.70.0030.00717.75
8.2.60.0000.01118.05
8.2.50.0050.00318.09
8.2.40.0060.00320.46
8.2.30.0040.00419.35
8.2.20.0000.00717.70
8.2.10.0000.00717.98
8.2.00.0070.00018.11
8.1.280.0100.00725.92
8.1.270.0090.00623.86
8.1.260.0000.00728.09
8.1.250.0040.00428.09
8.1.240.0060.00322.50
8.1.230.0040.00717.77
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0000.00917.35
8.1.190.0050.00317.35
8.1.180.0000.00918.10
8.1.170.0040.00418.66
8.1.160.0000.00720.75
8.1.150.0040.00420.72
8.1.140.0000.00819.52
8.1.130.0030.00317.72
8.1.120.0030.00617.53
8.1.110.0070.00017.35
8.1.100.0040.00417.54
8.1.90.0000.00717.48
8.1.80.0000.00717.42
8.1.70.0030.00317.52
8.1.60.0000.00817.59
8.1.50.0060.00317.59
8.1.40.0040.00417.43
8.1.30.0040.00417.61
8.1.20.0030.00517.52
8.1.10.0040.00417.46
8.1.00.0070.00017.59
8.0.300.0090.00018.84
8.0.290.0070.00016.75
8.0.280.0050.00318.50
8.0.270.0030.00317.27
8.0.260.0030.00318.39
8.0.250.0030.00317.00
8.0.240.0000.00716.89
8.0.230.0000.00716.91
8.0.220.0030.00316.86
8.0.210.0070.00016.97
8.0.200.0070.00016.94
8.0.190.0030.00617.06
8.0.180.0070.00317.00
8.0.170.0070.00316.94
8.0.160.0080.00017.04
8.0.150.0040.00416.92
8.0.140.0070.00016.82
8.0.130.0030.00313.38
8.0.120.0050.00316.89
8.0.110.0000.00716.99
8.0.100.0070.00016.96
8.0.90.0030.00516.88
8.0.80.0100.00716.99
8.0.70.0030.00516.95
8.0.60.0040.00416.84
8.0.50.0040.00417.00
8.0.30.0130.00517.23
8.0.20.0100.01317.40
8.0.10.0000.00716.90
8.0.00.0120.00916.88
7.4.330.0050.00016.66
7.4.320.0060.00016.58
7.4.300.0000.00716.53
7.4.290.0040.00416.63
7.4.280.0060.00316.41
7.4.270.0070.00016.54
7.4.260.0000.00716.60
7.4.250.0000.00716.50
7.4.240.0000.00716.50
7.4.230.0030.00316.36
7.4.220.0070.01516.48
7.4.210.0060.00916.66
7.4.200.0030.00316.52
7.4.160.0070.01016.62
7.4.150.0060.01217.40
7.4.140.0100.00717.86
7.4.130.0110.00816.55
7.4.120.0080.00916.54
7.4.110.0160.00016.43
7.4.100.0150.00616.55
7.4.90.0040.01316.66
7.4.80.0100.00719.39
7.4.70.0030.01716.66
7.4.60.0070.01016.45
7.4.50.0060.00616.63
7.4.40.0100.00716.42
7.4.30.0130.01016.74
7.4.10.0070.01015.14
7.4.00.0080.00814.84
7.3.330.0040.00413.43
7.3.320.0050.00013.21
7.3.310.0030.00316.50
7.3.300.0000.00716.44
7.3.290.0000.00616.47
7.3.280.0110.00716.41
7.3.270.0170.00017.40
7.3.260.0130.00916.38
7.3.250.0140.00516.57
7.3.240.0080.01216.51
7.3.230.0110.00916.39
7.3.210.0130.01016.44
7.3.200.0070.01019.39
7.3.190.0100.00716.44
7.3.180.0030.01316.54
7.3.170.0120.01016.42
7.3.160.0060.01216.45
7.3.130.0130.00615.00
7.3.120.0100.00314.83
7.3.110.0000.01815.02
7.3.100.0030.01314.59
7.3.90.0060.00614.87
7.3.80.0080.00415.03
7.3.70.0070.00714.73
7.3.60.0040.01114.57
7.3.50.0030.00614.70
7.3.40.0070.00714.76
7.3.30.0000.00914.61
7.3.20.0030.01216.61
7.3.10.0060.00916.86
7.3.00.0040.01116.56
7.2.330.0040.01516.80
7.2.320.0090.00916.64
7.2.310.0100.00616.47
7.2.300.0180.00016.69
7.2.290.0090.00616.50
7.2.260.0110.00715.23
7.2.250.0070.01015.35
7.2.240.0080.00814.88
7.2.230.0080.00815.06
7.2.220.0100.00714.74
7.2.210.0080.00414.93
7.2.200.0110.00415.05
7.2.190.0030.01315.26
7.2.180.0000.01015.08
7.2.170.0000.01715.14
7.2.160.0000.01614.98
7.2.150.0100.00616.92
7.2.140.0070.01016.67
7.2.130.0060.00917.03
7.2.120.0000.01017.12
7.2.110.0100.00316.99
7.2.100.0030.00817.16
7.2.90.0100.00717.05
7.2.80.0040.00817.09
7.2.70.0000.01117.19
7.2.60.0070.00716.97
7.2.50.0000.01516.86
7.2.40.0030.00717.01
7.2.30.0130.00317.09
7.2.20.0060.01017.04
7.2.10.0110.00317.02
7.2.00.0080.00518.27
7.1.330.0030.01015.79
7.1.320.0070.01015.78
7.1.310.0090.00615.96
7.1.300.0030.00615.69
7.1.290.0090.00315.67
7.1.280.0080.00815.80
7.1.270.0040.00815.85
7.1.260.0120.00315.79
7.1.250.0030.00915.73
7.1.240.0030.01015.75
7.1.230.0090.00615.89
7.1.220.0060.00615.82
7.1.210.0030.01215.67
7.1.200.0030.00615.87
7.1.190.0080.00415.87
7.1.180.0000.01715.77
7.1.170.0070.01015.82
7.1.160.0040.00715.87
7.1.150.0060.00615.86
7.1.140.0000.00915.69
7.1.130.0000.01115.60
7.1.120.0030.01315.75
7.1.110.0040.00815.80
7.1.100.0060.00916.88
7.1.90.0000.01415.95
7.1.80.0030.00916.02
7.1.70.0040.01016.66
7.1.60.0080.01217.62
7.1.50.0050.01116.40
7.1.40.0120.00615.81
7.1.30.0070.00715.63
7.1.20.0150.00015.78
7.1.10.0040.01115.94
7.1.00.0050.04019.07
7.0.330.0070.00315.26
7.0.320.0090.00615.46
7.0.310.0000.01515.15
7.0.300.0000.01415.48
7.0.290.0070.00715.36
7.0.280.0030.01015.35
7.0.270.0030.01015.43
7.0.260.0040.01215.36
7.0.250.0070.01015.45
7.0.240.0120.00615.39
7.0.230.0090.00315.31
7.0.220.0040.00415.43
7.0.210.0120.00415.59
7.0.200.0080.00815.05
7.0.190.0040.01115.41
7.0.180.0040.01115.50
7.0.170.0030.00615.42
7.0.160.0040.01115.33
7.0.150.0100.00615.38
7.0.140.0100.00715.64
7.0.130.0060.00315.38
7.0.120.0100.00015.48
7.0.110.0040.01115.33
7.0.100.0030.01215.36
7.0.90.0000.00815.48
7.0.80.0060.00615.38
7.0.70.0070.01015.33
7.0.60.0130.04517.76
7.0.50.0090.04116.68
7.0.40.0070.04616.88
7.0.30.0150.03716.81
7.0.20.0220.04316.83
7.0.10.0100.04416.76
7.0.00.0070.02616.82
5.6.400.0030.00614.28
5.6.390.0110.00414.79
5.6.380.0040.00714.46
5.6.370.0090.00614.39
5.6.360.0100.00314.47
5.6.350.0000.01614.28
5.6.340.0040.00814.56
5.6.330.0000.01414.48
5.6.320.0030.00914.32
5.6.310.0090.00914.16
5.6.300.0070.01114.29
5.6.290.0030.01314.75
5.6.280.0040.01817.57
5.6.270.0000.01414.32
5.6.260.0030.01014.29
5.6.250.0070.00414.59
5.6.240.0000.01514.33
5.6.230.0100.00614.36
5.6.220.0030.01014.59
5.6.210.0070.04617.53
5.6.200.0030.05016.28
5.6.190.0030.02417.36
5.6.180.0130.02617.58
5.6.170.0170.04117.42
5.6.160.0070.04417.41
5.6.150.0040.02516.11
5.6.140.0090.04216.26
5.6.130.0050.04716.25
5.6.120.0080.04017.65
5.6.110.0030.04517.81
5.6.100.0050.04817.59
5.6.90.0110.03817.66
5.6.80.0050.02417.39
5.6.70.0070.00714.34
5.6.60.0030.00914.21
5.6.50.0000.01414.23
5.6.40.0110.00314.36
5.6.30.0030.01014.16
5.6.20.0070.01014.33
5.6.10.0110.00414.24
5.6.00.0100.00314.19
5.5.380.0060.00614.10
5.5.370.0140.00014.49
5.5.360.0070.00714.34
5.5.350.0130.04217.53
5.5.340.0050.02616.11
5.5.330.0020.02917.51
5.5.320.0270.02017.25
5.5.310.0120.02817.40
5.5.300.0050.02716.39
5.5.290.0050.02716.21
5.5.280.0120.04017.54
5.5.270.0090.04417.55
5.5.260.0080.04317.76
5.5.250.0070.02817.34
5.5.240.2070.02317.19
5.5.230.0070.01014.31
5.5.220.0070.00314.37
5.5.210.0070.00714.01
5.5.200.0060.00314.05
5.5.190.0000.01714.01
5.5.180.0070.01014.31
5.5.170.0080.00314.11
5.5.160.0070.00714.23
5.5.150.0030.00714.41
5.5.140.0070.00414.43
5.5.130.0030.00814.35
5.5.120.0100.00314.33
5.5.110.0100.00714.33
5.5.100.0130.00314.45
5.5.90.0060.00613.94
5.5.80.0040.00814.14
5.5.70.0040.01214.38
5.5.60.0100.00314.14
5.5.50.0060.01014.02
5.5.40.0060.00914.04
5.5.30.0080.00814.43
5.5.20.0090.00914.35
5.5.10.0060.00613.93
5.5.00.0090.00314.38

preferences:
48.85 ms | 401 KiB | 5 Q