3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Item { private $cost = 100; public function getTotal($discount = 7) { return self::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.0070.00716.50
8.3.50.0100.01021.21
8.3.40.0110.00418.69
8.3.30.0110.00418.84
8.3.20.0040.00420.30
8.3.10.0000.00721.89
8.3.00.0000.00823.54
8.2.180.0070.00718.43
8.2.170.0070.00722.96
8.2.160.0100.00320.28
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0000.00726.16
8.2.120.0080.00019.85
8.2.110.0030.00619.30
8.2.100.0060.00617.93
8.2.90.0040.00419.34
8.2.80.0000.00817.97
8.2.70.0030.00617.50
8.2.60.0090.00018.03
8.2.50.0090.00018.09
8.2.40.0060.00322.21
8.2.30.0070.00319.30
8.2.20.0050.00217.69
8.2.10.0060.00318.07
8.2.00.0000.00717.95
8.1.280.0110.00425.92
8.1.270.0040.00423.96
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0000.00822.61
8.1.230.0060.00617.64
8.1.220.0000.00817.78
8.1.210.0080.00018.77
8.1.200.0000.00917.23
8.1.190.0030.00617.25
8.1.180.0060.00318.10
8.1.170.0000.00918.50
8.1.160.0070.00020.70
8.1.150.0000.00820.59
8.1.140.0080.00019.59
8.1.130.0030.00317.65
8.1.120.0040.00817.48
8.1.110.0000.00817.46
8.1.100.0040.00417.48
8.1.90.0050.00317.48
8.1.80.0040.00417.52
8.1.70.0000.00717.32
8.1.60.0030.00517.67
8.1.50.0030.00617.46
8.1.40.0040.00417.51
8.1.30.0040.00417.66
8.1.20.0030.00517.66
8.1.10.0070.00017.56
8.1.00.0040.00417.44
8.0.300.0040.00418.78
8.0.290.0070.00016.88
8.0.280.0000.00718.47
8.0.270.0040.00417.27
8.0.260.0000.00617.26
8.0.250.0030.00517.08
8.0.240.0030.00317.00
8.0.230.0030.00316.89
8.0.220.0040.00417.01
8.0.210.0030.00316.85
8.0.200.0040.00416.91
8.0.190.0000.00917.01
8.0.180.0060.00316.88
8.0.170.0040.00716.98
8.0.160.0080.00016.96
8.0.150.0040.00416.93
8.0.140.0030.00316.82
8.0.130.0060.00013.44
8.0.120.0040.00416.80
8.0.110.0000.00816.89
8.0.100.0000.00716.99
8.0.90.0000.00816.91
8.0.80.0100.01316.92
8.0.70.0000.00716.90
8.0.60.0000.00717.01
8.0.50.0030.00517.07
8.0.30.0110.00617.25
8.0.20.0120.00717.41
8.0.10.0040.00417.09
8.0.00.0110.01216.71
7.4.330.0050.00016.82
7.4.320.0030.00316.47
7.4.300.0060.00316.51
7.4.290.0030.00316.61
7.4.280.0000.00716.52
7.4.270.0050.00216.66
7.4.260.0030.00316.51
7.4.250.0000.00716.48
7.4.240.0070.00016.54
7.4.230.0000.00716.60
7.4.220.0130.00916.44
7.4.210.0110.00416.58
7.4.200.0030.00316.60
7.4.160.0120.00316.72
7.4.150.0160.00617.40
7.4.140.0070.01217.86
7.4.130.0090.01216.52
7.4.120.0120.00616.46
7.4.110.0100.00716.66
7.4.100.0120.00616.44
7.4.90.0150.00316.43
7.4.80.0040.01219.39
7.4.70.0060.01116.54
7.4.60.0030.01316.52
7.4.50.0030.01016.31
7.4.40.0100.00616.65
7.4.30.0110.00716.40
7.4.10.0070.01115.07
7.4.00.0080.00715.16
7.3.330.0030.00513.26
7.3.320.0000.00513.40
7.3.310.0000.00716.44
7.3.300.0030.00316.39
7.3.290.0000.00716.27
7.3.280.0060.01116.45
7.3.270.0150.00317.40
7.3.260.0100.00716.39
7.3.250.0060.01216.51
7.3.240.0080.00916.64
7.3.230.0030.01316.49
7.3.210.0210.00416.60
7.3.200.0090.00616.36
7.3.190.0030.01416.38
7.3.180.0070.01016.41
7.3.170.0120.01216.31
7.3.160.0090.00816.38
7.3.130.0130.00315.07
7.3.120.0030.01215.07
7.3.110.0130.00315.07
7.3.100.0100.00715.19
7.3.90.0030.00915.07
7.3.80.0120.00315.07
7.3.70.0110.00415.07
7.3.60.0100.00315.07
7.3.50.0100.00715.07
7.3.40.0070.00715.07
7.3.30.0070.00715.07
7.3.20.0070.00716.81
7.3.10.0090.00916.46
7.3.00.0060.01016.76
7.2.330.0070.01116.75
7.2.320.0190.00716.75
7.2.310.0060.01116.79
7.2.300.0070.01016.44
7.2.290.0070.00816.79
7.2.260.0070.01115.07
7.2.250.0030.01715.07
7.2.240.0070.00715.22
7.2.230.0040.01115.18
7.2.220.0100.00315.07
7.2.210.0060.01015.07
7.2.200.0110.00415.07
7.2.190.0090.00915.07
7.2.180.0030.00815.07
7.2.170.0080.00815.07
7.2.160.0030.01215.07
7.2.150.0060.01016.83
7.2.140.0120.00416.98
7.2.130.0030.01216.71
7.2.120.0000.01216.89
7.2.110.0090.00616.66
7.2.100.0090.00616.82
7.2.90.0070.00716.88
7.2.80.0060.00617.12
7.2.70.0030.01017.14
7.2.60.0110.00316.79
7.2.50.0070.01016.67
7.2.40.0060.00916.91
7.2.30.0030.00917.01
7.2.20.0060.00916.90
7.2.10.0090.00617.04
7.2.00.0020.01018.14
7.1.330.0090.00615.78
7.1.320.0070.00715.98
7.1.310.0050.00515.93
7.1.300.0140.00315.86
7.1.290.0030.01015.63
7.1.280.0060.00915.84
7.1.270.0070.01015.98
7.1.260.0130.00015.77
7.1.250.0030.00615.87
7.1.240.0070.00715.75
7.1.230.0110.00315.84
7.1.220.0060.00615.89
7.1.210.0030.00915.69
7.1.200.0050.00715.73
7.1.190.0070.00715.61
7.1.180.0040.00815.68
7.1.170.0000.00916.01
7.1.160.0000.00815.71
7.1.150.0040.00415.93
7.1.140.0060.00315.83
7.1.130.0060.00315.81
7.1.120.0110.00315.85
7.1.110.0040.00415.89
7.1.100.0050.00916.77
7.1.90.0000.01315.82
7.1.80.0030.01415.86
7.1.70.0000.01216.40
7.1.60.0070.01217.54
7.1.50.0090.01116.24
7.1.40.0070.00715.66
7.1.30.0030.00915.95
7.1.20.0030.01015.88
7.1.10.0030.01015.70
7.1.00.0030.04119.12
7.0.330.0030.00615.44
7.0.320.0030.01015.39
7.0.310.0000.01115.47
7.0.300.0030.00715.35
7.0.290.0060.00915.40
7.0.280.0000.01315.15
7.0.270.0030.00715.26
7.0.260.0040.01115.38
7.0.250.0090.00915.46
7.0.240.0030.00915.60
7.0.230.0030.00615.28
7.0.220.0060.00315.40
7.0.210.0070.00715.26
7.0.200.0040.00915.06
7.0.190.0140.00315.37
7.0.180.0000.01215.38
7.0.170.0090.00315.55
7.0.160.0030.00915.34
7.0.150.0090.00615.38
7.0.140.0030.00915.38
7.0.130.0030.00915.08
7.0.120.0030.00915.35
7.0.110.0060.00315.45
7.0.100.0000.01315.36
7.0.90.0000.01115.52
7.0.80.0090.00315.42
7.0.70.0060.00915.35
7.0.60.0170.03717.72
7.0.50.0080.03716.73
7.0.40.0080.04817.65
7.0.30.0120.03217.59
7.0.20.0170.04817.61
7.0.10.0100.03517.61
7.0.00.0100.04317.69
5.6.400.0030.01015.07
5.6.390.0080.00815.07
5.6.380.0040.01115.07
5.6.370.0040.00815.07
5.6.360.0040.00715.07
5.6.350.0000.01015.07
5.6.340.0070.00715.07
5.6.330.0040.00715.07
5.6.320.0060.01315.07
5.6.310.0060.01015.07
5.6.300.0030.00615.07
5.6.290.0000.01115.07
5.6.280.0020.02018.08
5.6.270.0030.00815.07
5.6.260.0030.00615.07
5.6.250.0070.01015.07
5.6.240.0110.00315.07
5.6.230.0000.01315.07
5.6.220.0040.01215.07
5.6.210.0080.02617.78
5.6.200.0080.04316.61
5.6.190.0090.02217.80
5.6.180.0130.04217.70
5.6.170.0180.04417.89
5.6.160.0080.04117.82
5.6.150.0050.03416.67
5.6.140.0080.04116.63
5.6.130.0070.04516.62
5.6.120.0090.04518.04
5.6.110.0050.05018.03
5.6.100.0060.05118.11
5.6.90.0100.03517.98
5.6.80.0020.02717.71
5.6.70.0030.01215.07
5.6.60.0000.01315.07
5.6.50.0070.01015.07
5.6.40.0030.01015.07
5.6.30.0070.00415.07
5.6.20.0050.00315.07
5.6.10.0030.00615.07
5.6.00.0070.00715.07
5.5.380.0030.01215.07
5.5.370.0070.00715.07
5.5.360.0070.00715.07
5.5.350.0120.03317.77
5.5.340.0160.03816.50
5.5.330.0080.04617.71
5.5.320.0120.02717.69
5.5.310.0060.02617.69
5.5.300.0040.03516.50
5.5.290.0070.02316.58
5.5.280.0100.04417.94
5.5.270.0060.03317.94
5.5.260.0130.04217.97
5.5.250.0070.04517.88
5.5.240.1970.02217.55
5.5.230.0030.01015.07
5.5.220.0080.00015.07
5.5.210.0100.00315.07
5.5.200.0030.00715.07
5.5.190.0060.00915.07
5.5.180.0000.00915.07
5.5.170.0000.00915.07
5.5.160.0000.01115.07
5.5.150.0070.00715.07
5.5.140.0000.00915.07
5.5.130.0090.00615.07
5.5.120.0120.00315.07
5.5.110.0110.00315.07
5.5.100.0000.01115.07
5.5.90.0030.01015.07
5.5.80.0060.00615.07
5.5.70.0080.00015.07
5.5.60.0000.01315.07
5.5.50.0040.00815.07
5.5.40.0030.01015.07
5.5.30.0000.00915.07
5.5.20.0030.01215.07
5.5.10.0030.00615.07
5.5.00.0030.00615.07

preferences:
49.68 ms | 401 KiB | 5 Q