3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Item { private static $cost = 100; public function getTotal($discount = 7) { return self::cost * $discount/(100+$discount); } } class Hydrator { 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(); $hydrated = new Hydrator(); $getFoo = $hydrated->getPrivate($obj, 'cost'); $setFoo = $hydrated->setPrivate($obj, 'cost'); echo $obj->getTotal() .PHP_EOL; $setFoo(1); echo $obj->getTotal() .PHP_EOL;

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.0000.01516.61
8.3.50.0130.00921.09
8.3.40.0040.01118.83
8.3.30.0070.00718.84
8.3.20.0080.00020.14
8.3.10.0080.00023.70
8.3.00.0050.00323.73
8.2.180.0140.00716.88
8.2.170.0090.00622.96
8.2.160.0140.00720.36
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0030.00520.84
8.2.120.0080.00026.35
8.2.110.0030.00722.26
8.2.100.0110.00018.03
8.2.90.0000.00817.63
8.2.80.0030.00617.97
8.2.70.0040.00418.04
8.2.60.0030.00617.93
8.2.50.0040.00418.10
8.2.40.0060.00319.32
8.2.30.0030.00519.16
8.2.20.0020.00517.63
8.2.10.0000.00718.09
8.2.00.0000.00818.14
8.1.280.0100.01025.92
8.1.270.0060.00323.99
8.1.260.0050.00326.35
8.1.250.0100.00028.09
8.1.240.0100.00722.42
8.1.230.0040.00720.82
8.1.220.0050.00318.77
8.1.210.0000.00819.02
8.1.200.0040.00417.35
8.1.190.0000.00817.23
8.1.180.0040.00418.10
8.1.170.0060.00318.88
8.1.160.0000.00718.88
8.1.150.0040.00418.82
8.1.140.0080.00019.54
8.1.130.0080.00017.71
8.1.120.0030.00617.34
8.1.110.0040.00417.42
8.1.100.0000.00817.44
8.1.90.0070.00017.44
8.1.80.0030.00317.49
8.1.70.0030.00317.48
8.1.60.0050.00317.59
8.1.50.0040.00417.45
8.1.40.0030.00617.51
8.1.30.0040.00417.57
8.1.20.0060.00317.59
8.1.10.0030.00617.49
8.1.00.0050.00317.42
8.0.300.0040.00419.85
8.0.290.0000.00916.75
8.0.280.0070.00018.45
8.0.270.0030.00317.17
8.0.260.0000.00817.17
8.0.250.0070.00017.06
8.0.240.0040.00417.09
8.0.230.0040.00416.98
8.0.220.0050.00316.97
8.0.210.0050.00316.89
8.0.200.0000.00716.99
8.0.190.0040.00417.08
8.0.180.0070.00416.98
8.0.170.0060.00317.03
8.0.160.0040.00316.87
8.0.150.0070.00016.77
8.0.140.0000.00816.91
8.0.130.0060.00313.35
8.0.120.0000.00716.82
8.0.110.0070.00016.89
8.0.100.0040.00416.97
8.0.90.0070.00016.81
8.0.80.0070.01016.95
8.0.70.0000.00717.01
8.0.60.0000.00716.84
8.0.50.0050.00216.84
8.0.30.0110.00917.18
8.0.20.0110.00917.40
8.0.10.0000.00717.14
8.0.00.0110.00816.76
7.4.330.0000.00416.79
7.4.320.0030.00316.59
7.4.300.0040.00416.36
7.4.290.0000.00716.50
7.4.280.0060.00316.51
7.4.270.0050.00216.62
7.4.260.0070.00016.53
7.4.250.0070.00016.57
7.4.240.0030.00316.56
7.4.230.0070.00016.55
7.4.220.0090.01616.58
7.4.210.0050.01016.42
7.4.200.0040.00416.63
7.4.160.0000.01516.73
7.4.150.0060.01317.40
7.4.140.0110.00917.86
7.4.130.0090.00916.58
7.4.120.0070.01116.44
7.4.110.0030.01316.45
7.4.100.0070.01016.52
7.4.90.0060.01016.51
7.4.80.0060.01019.39
7.4.70.0100.00716.48
7.4.60.0060.01016.70
7.4.50.0100.00316.50
7.4.40.0100.00716.43
7.4.30.0030.01916.65
7.4.00.0080.00814.91
7.3.330.0030.00313.40
7.3.320.0000.00613.30
7.3.310.0070.00016.29
7.3.300.0030.00316.43
7.3.290.0070.00016.34
7.3.280.0010.01516.39
7.3.270.0030.01617.40
7.3.260.0080.00816.34
7.3.250.0090.01016.44
7.3.240.0050.01216.51
7.3.230.0080.00816.62
7.3.210.0130.00316.53
7.3.200.0050.01119.39
7.3.190.0110.00516.38
7.3.180.0090.00616.47
7.3.170.0180.01116.36
7.3.160.0080.00816.44
7.3.120.0080.01014.82
7.3.110.0080.00814.74
7.3.100.0080.00514.69
7.3.90.0030.01014.83
7.3.80.0090.00314.82
7.3.70.0060.00914.80
7.3.60.0040.01114.84
7.3.50.0060.00714.88
7.3.40.0030.01014.96
7.3.30.0030.00914.83
7.3.20.0090.00616.87
7.3.10.0060.00816.58
7.3.00.0070.00816.66
7.2.330.0040.01416.80
7.2.320.0110.00816.81
7.2.310.0160.00616.68
7.2.300.0100.00716.75
7.2.290.0030.01316.80
7.2.250.0080.00915.01
7.2.240.0090.00914.94
7.2.230.0060.00915.20
7.2.220.0050.00915.20
7.2.210.0060.01014.94
7.2.200.0050.00715.04
7.2.190.0110.00414.90
7.2.180.0070.00515.02
7.2.170.0030.01215.13
7.2.130.0090.00816.84
7.2.120.0070.01016.69
7.2.110.0100.00716.67
7.2.100.0090.00716.75
7.2.90.0120.00516.78
7.2.80.0070.01316.78
7.2.70.0100.00516.70
7.2.60.0090.01016.95
7.2.50.0070.00516.82
7.2.40.0100.00916.75
7.2.30.0110.00516.66
7.2.20.0070.00916.97
7.2.10.0060.00716.81
7.2.00.0060.00917.69
7.1.330.0090.00515.69
7.1.320.0030.01015.81
7.1.310.0080.00615.57
7.1.300.0110.00515.80
7.1.290.0030.00815.75
7.1.280.0070.00515.59
7.1.270.0050.00715.74
7.1.260.0090.00515.70
7.1.250.0050.00715.68
7.1.240.0070.00715.93
7.1.230.0030.01015.96
7.1.220.0060.01015.86
7.1.210.0000.00915.90
7.1.200.0050.00815.79
7.1.190.0030.00715.58
7.1.180.0000.01415.59
7.1.170.0070.00715.80
7.1.160.0030.00715.82
7.1.150.0030.01015.71
7.1.140.0080.00615.87
7.1.130.0060.00615.73
7.1.120.0090.00915.64
7.1.110.0110.00415.96
7.1.100.0090.00516.85
7.1.90.0140.00016.00
7.1.80.0090.00815.85
7.1.70.0020.00616.44
7.1.60.0050.01517.61
7.1.50.0060.00816.29
7.1.40.0000.01315.85
7.1.30.0030.01015.60
7.1.20.0000.01415.93
7.1.10.0000.01015.82
7.1.00.0020.04519.08
7.0.330.0160.00015.59
7.0.320.0040.01115.48
7.0.310.0030.01315.53
7.0.300.0060.00315.35
7.0.290.0030.00615.03
7.0.280.0040.00815.41
7.0.270.0040.01115.36
7.0.260.0110.00415.52
7.0.250.0060.00615.63
7.0.240.0110.00315.32
7.0.230.0070.00415.14
7.0.220.0130.00015.21
7.0.210.0040.00815.21
7.0.200.0080.00615.01
7.0.190.0030.00615.39
7.0.180.0030.00915.25
7.0.170.0070.00315.50
7.0.160.0080.00815.41
7.0.150.0060.00915.40
7.0.140.0030.01015.39
7.0.130.0040.00815.07
7.0.120.0120.00015.49
7.0.110.0000.00815.44
7.0.100.0080.04117.62
7.0.90.0030.04517.75
7.0.80.0130.02517.70
7.0.70.0050.03617.63
7.0.60.0070.03917.53
7.0.50.0000.02817.78
7.0.40.0080.04316.82
7.0.30.0050.04716.83
7.0.20.0040.02216.73
7.0.10.0030.03316.65
7.0.00.0030.02816.54
5.6.380.0100.00314.55
5.6.370.0090.00914.62
5.6.360.0150.00314.31
5.6.350.0070.00714.13
5.6.340.0030.01013.97
5.6.330.0000.01314.19
5.6.320.0060.00614.25
5.6.310.0030.01014.45
5.6.300.0040.01114.43
5.6.290.0000.01314.52
5.6.280.0040.01817.57
5.6.270.0030.00614.69
5.6.260.0070.00714.23
5.6.250.0030.04817.66
5.6.240.0030.04017.62
5.6.230.0050.03517.46
5.6.220.0050.03817.46
5.6.210.0060.02317.54
5.6.200.0070.02317.78
5.6.190.0120.03417.67
5.6.180.0070.02917.61
5.6.170.0060.04317.62
5.6.160.0030.02817.61
5.6.150.0050.03217.55
5.6.140.0080.03317.62
5.6.130.0030.02517.74
5.6.120.0050.02817.64
5.6.110.0050.02317.70
5.6.100.0070.03417.62
5.6.90.0070.02217.79
5.6.80.0060.02017.18
5.6.70.0030.02317.26
5.6.60.0030.02217.32
5.6.50.0070.02017.19
5.6.40.0050.02417.50
5.6.30.0050.02417.13
5.6.20.0080.03517.36
5.6.10.0060.02117.42
5.6.00.0080.02217.25
5.5.380.0100.04015.92
5.5.370.0050.03015.91
5.5.360.0100.04015.83
5.5.350.0040.02215.88
5.5.340.0070.02816.02
5.5.330.0060.04116.16
5.5.320.0030.02115.98
5.5.310.0040.04415.89
5.5.300.0040.02416.02
5.5.290.0080.02715.98
5.5.280.0020.02515.87
5.5.270.0050.03216.01
5.5.260.0060.02816.06
5.5.250.0030.02415.73
5.5.240.0050.02815.60
5.5.230.0020.02615.73
5.5.220.0030.02515.56
5.5.210.0030.03715.58
5.5.200.0030.04215.68
5.5.190.0010.02615.74
5.5.180.0080.01815.54
5.5.170.0040.00810.77
5.5.160.0050.02015.71
5.5.150.0050.02115.46
5.5.140.0030.02015.77
5.5.130.0070.01815.81
5.5.120.0120.02015.55
5.5.110.0050.02115.57
5.5.100.0080.03015.53
5.5.90.0030.02815.67
5.5.80.0050.03715.61
5.5.70.0070.02015.50
5.5.60.0030.02215.59
5.5.50.0030.02515.44
5.5.40.0050.02015.56
5.5.30.0020.02215.46
5.5.20.0040.02115.57
5.5.10.0030.02515.59
5.5.00.0040.02215.62

preferences:
65.48 ms | 401 KiB | 5 Q