3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Product { public $price; public function __construct($price) { $this->price = $price; } } class Calculator { public $modifiers = []; public function __construct(array $modifiers) { $this->modifiers = $modifiers; } public function calculate($value) { foreach ($this->modifiers as $modifier) { $value = $modifier->modify($value); } return $value; } } interface Modifier { function modify($value); } class TaxModifier { public $percent; public function modify($value) { return $value * ($this->percent + 1); } public function __construct($percent) { $this->percent = $percent; } } class DiscountModifier { public $discount; public function modify($value) { return $value - $this->discount; } public function __construct($discount) { $this->discount = $discount; } } $product = new Product(19.95); $calculator = new Calculator([ new TaxModifier(0.07), new TaxModifier(0.08), new DiscountModifier(8.00), ]); echo $calculator->calculate($product->price);

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.0060.01918.43
8.3.50.0150.00521.33
8.3.40.0120.00319.02
8.3.30.0090.00619.98
8.3.20.0080.00018.90
8.3.10.0000.00821.09
8.3.00.0050.00223.66
8.2.180.0180.00416.63
8.2.170.0070.00722.96
8.2.160.0070.00720.52
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0000.00726.16
8.2.120.0040.00419.89
8.2.110.0080.00320.35
8.2.100.0060.00617.94
8.2.90.0000.00818.34
8.2.80.0060.00319.23
8.2.70.0090.00917.25
8.2.60.0050.00317.93
8.2.50.0080.00018.07
8.2.40.0050.00318.22
8.2.30.0040.00419.46
8.2.20.0040.00417.73
8.2.10.0030.00617.77
8.2.00.0000.00817.75
8.1.280.0180.00025.92
8.1.270.0050.00323.99
8.1.260.0060.00326.35
8.1.250.0030.00528.09
8.1.240.0030.00622.19
8.1.230.0080.00420.91
8.1.220.0000.00817.74
8.1.210.0080.00019.03
8.1.200.0060.00317.36
8.1.190.0000.00717.63
8.1.180.0050.00318.10
8.1.170.0000.00818.52
8.1.160.0070.00018.84
8.1.150.0000.00918.54
8.1.140.0050.00217.49
8.1.130.0000.00717.86
8.1.120.0070.00317.32
8.1.110.0040.00417.54
8.1.100.0050.00217.39
8.1.90.0000.00817.40
8.1.80.0020.00517.34
8.1.70.0000.00717.41
8.1.60.0080.00017.65
8.1.50.0060.00317.54
8.1.40.0040.00417.43
8.1.30.0040.00417.53
8.1.20.0030.00617.55
8.1.10.0040.00417.54
8.1.00.0060.00317.56
8.0.300.0040.00419.97
8.0.290.0040.00417.05
8.0.280.0000.00718.41
8.0.270.0030.00317.28
8.0.260.0040.00416.90
8.0.250.0040.00417.00
8.0.240.0040.00416.99
8.0.230.0000.00717.05
8.0.220.0070.00016.89
8.0.210.0000.00816.96
8.0.200.0040.00416.97
8.0.190.0080.00016.92
8.0.180.0030.00716.96
8.0.170.0040.00416.89
8.0.160.0070.00016.95
8.0.150.0000.00716.93
8.0.140.0050.00216.84
8.0.130.0030.00313.39
8.0.120.0000.00816.92
8.0.110.0030.00416.92
8.0.100.0030.00516.92
8.0.90.0030.00516.81
8.0.80.0060.01016.91
8.0.70.0000.00716.99
8.0.60.0000.00816.87
8.0.50.0040.00416.82
8.0.30.0090.00917.20
8.0.20.0080.01117.40
8.0.10.0040.00416.86
8.0.00.0070.01116.75
7.4.330.0050.00016.82
7.4.320.0000.00616.64
7.4.300.0000.00716.54
7.4.290.0000.00716.44
7.4.280.0030.00316.54
7.4.270.0070.00016.62
7.4.260.0050.00013.29
7.4.250.0040.00416.58
7.4.240.0030.00316.54
7.4.230.0000.00716.68
7.4.220.0140.01416.62
7.4.210.0080.00716.60
7.4.200.0030.00316.44
7.4.190.0070.00016.59
7.4.160.0110.00416.31
7.4.150.0150.00417.40
7.4.140.0070.01017.86
7.4.130.0090.00816.48
7.4.120.0110.00616.44
7.4.110.0120.00616.55
7.4.100.0120.00616.52
7.4.90.0150.00716.55
7.4.80.0070.01119.39
7.4.70.0130.01016.54
7.4.60.0070.01016.49
7.4.50.0000.00916.54
7.4.40.0040.01122.77
7.4.30.0150.00316.41
7.4.10.0050.01315.01
7.4.00.0040.01215.11
7.3.330.0030.00313.36
7.3.320.0030.00313.15
7.3.310.0030.00316.49
7.3.300.0030.00316.44
7.3.290.0130.00016.40
7.3.280.0080.00916.34
7.3.270.0160.00217.40
7.3.260.0100.00818.24
7.3.250.0090.01216.54
7.3.240.0120.00516.57
7.3.230.0030.01316.40
7.3.210.0070.01016.75
7.3.200.0100.01019.39
7.3.190.0120.00916.46
7.3.180.0130.00316.37
7.3.170.0150.00616.40
7.3.160.0100.00716.67
7.3.130.0090.00814.89
7.3.120.0080.00815.00
7.3.110.0080.01014.89
7.3.100.0040.01014.91
7.3.90.0060.00915.03
7.3.80.0050.00514.93
7.3.70.0050.00914.90
7.3.60.0050.00815.00
7.3.50.0030.00814.81
7.3.40.0050.00914.66
7.3.30.0030.01214.85
7.3.20.0030.00916.61
7.3.10.0030.00816.73
7.3.00.0070.00516.50
7.2.330.0090.00916.84
7.2.320.0060.01616.53
7.2.310.0150.00416.53
7.2.300.0100.00616.45
7.2.290.0100.00616.80
7.2.260.0070.01215.18
7.2.250.0080.01115.24
7.2.240.0060.00915.19
7.2.230.0070.01015.08
7.2.220.0050.01014.76
7.2.210.0040.00515.00
7.2.200.0050.01215.15
7.2.190.0080.00915.15
7.2.180.0080.00315.12
7.2.170.0070.00715.10
7.2.160.0090.00715.00
7.2.150.0060.00917.05
7.2.140.0050.01016.75
7.2.130.0070.00617.03
7.2.120.0060.00817.02
7.2.110.0060.00616.97
7.2.100.0080.00616.96
7.2.90.0080.00917.13
7.2.80.0050.00916.99
7.2.70.0020.01117.05
7.2.60.0090.00417.03
7.2.50.0020.01216.89
7.2.40.0100.00617.12
7.2.30.0090.00517.06
7.2.20.0030.00816.79
7.2.10.0050.00616.87
7.2.00.0050.01017.01
7.1.330.0040.01115.88
7.1.320.0050.00915.90
7.1.310.0040.00915.76
7.1.300.0040.01115.84
7.1.290.0070.00815.85
7.1.280.0050.00815.91
7.1.270.0020.01415.72
7.1.260.0070.00215.90
7.1.250.0110.00315.84
7.1.240.0020.00815.79
7.1.230.0050.00715.81
7.1.220.0040.00915.80
7.1.210.0060.00615.79
7.1.200.0020.01215.88
7.1.190.0030.01015.94
7.1.180.0050.00415.83
7.1.170.0040.00815.97
7.1.160.0020.01215.64
7.1.150.0050.01015.77
7.1.140.0040.00915.68
7.1.130.0020.00915.78
7.1.120.0030.01015.73
7.1.110.0100.00516.03
7.1.100.0060.00816.64
7.1.90.0040.00515.63
7.1.80.0080.00715.68
7.1.70.0060.00816.11
7.1.60.0090.00816.90
7.1.50.0060.01116.13
7.1.40.0020.01215.72
7.1.30.0090.00715.71
7.1.20.0050.00915.83
7.1.10.0070.00915.71
7.1.00.0040.01718.05
7.0.330.0030.00715.26
7.0.320.0030.00815.44
7.0.310.0020.00615.37
7.0.300.0050.00915.31
7.0.290.0030.00715.34
7.0.280.0050.00715.32
7.0.270.0090.00515.38
7.0.260.0030.00915.44
7.0.250.0050.01115.48
7.0.240.0050.00715.44
7.0.230.0070.00615.19
7.0.220.0010.01015.53
7.0.210.0030.01015.54
7.0.200.0050.00615.83
7.0.190.0060.00515.51
7.0.180.0030.01015.55
7.0.170.0050.00615.27
7.0.160.0040.00915.44
7.0.150.0050.01015.53
7.0.140.0080.02617.67
7.0.130.0080.00615.50
7.0.120.0050.00915.53
7.0.110.0050.01015.51
7.0.100.0110.02717.54
7.0.90.0060.02717.45
7.0.80.0060.03017.44
7.0.70.0020.03617.57
7.0.60.0100.02917.50
7.0.50.0090.02817.71
7.0.40.0010.03515.78
7.0.30.0030.03015.74
7.0.20.0080.02715.63
7.0.10.0080.02015.72
7.0.00.0030.03215.77
5.6.400.0050.01014.37
5.6.390.0080.00414.22
5.6.380.0070.00714.21
5.6.370.0000.01014.47
5.6.360.0050.00714.53
5.6.350.0060.00314.25
5.6.340.0050.00914.67
5.6.330.0030.00914.41
5.6.320.0110.00514.34
5.6.310.0080.00514.72
5.6.300.0020.00814.38
5.6.290.0050.01014.26
5.6.280.0030.02916.68
5.6.270.0060.00614.32
5.6.260.0040.00814.47
5.6.250.0080.03216.50
5.6.240.0070.03116.57
5.6.230.0050.03316.53
5.6.220.0010.03516.47
5.6.210.0050.03216.44
5.6.200.0050.03516.64
5.6.190.0050.03216.72
5.6.180.0030.03316.53
5.6.170.0080.02916.58
5.6.160.0050.03216.56
5.6.150.0060.03016.55
5.6.140.0040.03116.75
5.6.130.0070.02916.63
5.6.120.0080.03116.68
5.6.110.0070.03016.70
5.6.100.0070.01816.55
5.6.90.0000.03316.54
5.6.80.0100.01516.37
5.6.70.0050.03116.37
5.6.60.0070.02816.40
5.6.50.0060.03116.41
5.6.40.0090.01716.41
5.6.30.0050.02116.27
5.6.20.0040.03516.25
5.6.10.0040.02116.36
5.6.00.0070.02916.37
5.5.380.0080.03116.43
5.5.370.0070.02516.52
5.5.360.0040.03316.43
5.5.350.0050.03116.29
5.5.340.0060.02916.48
5.5.330.0050.03516.61
5.5.320.0060.02916.59
5.5.310.0060.02116.51
5.5.300.0050.02916.51
5.5.290.0060.02616.55
5.5.280.0100.02816.49
5.5.270.0040.03216.43
5.5.260.0020.03416.57
5.5.250.0060.03016.37
5.5.240.0050.03216.37
5.5.230.0020.02216.25
5.5.220.0040.03316.26
5.5.210.0020.03416.16
5.5.200.0010.02716.23
5.5.190.0050.03216.37
5.5.180.0070.03216.26
5.5.170.0060.00514.36
5.5.160.0080.02116.25
5.5.150.0040.02216.30
5.5.140.0060.02216.26
5.5.130.0070.02616.23
5.5.120.0040.02816.20
5.5.110.0060.02816.30
5.5.100.0070.03116.30
5.5.90.0050.03316.30
5.5.80.0070.02816.24
5.5.70.0040.02116.15
5.5.60.0050.02716.19
5.5.50.0060.02616.15
5.5.40.0040.03116.26
5.5.30.0060.02216.27
5.5.20.0050.03116.21
5.5.10.0050.02816.25
5.5.00.0030.03016.21
5.4.450.0080.02813.90
5.4.440.0040.03413.89
5.4.430.0050.02813.90
5.4.420.0010.03313.81
5.4.410.0020.02913.91
5.4.400.0050.02713.76
5.4.390.0030.02813.67
5.4.380.0030.03013.89
5.4.370.0070.01613.75
5.4.360.0030.03213.78
5.4.350.0050.02813.82
5.4.340.0080.02613.87
5.4.330.0070.00211.32
5.4.320.0030.02113.90
5.4.310.0050.02413.86
5.4.300.0050.02813.75
5.4.290.0030.02713.77
5.4.280.0040.02913.74
5.4.270.0070.02413.74
5.4.260.0040.01813.71
5.4.250.0050.02713.69
5.4.240.0030.02413.63
5.4.230.0020.02713.67
5.4.220.0080.02113.71
5.4.210.0060.02813.80
5.4.200.0090.02613.79
5.4.190.0020.03213.74
5.4.180.0070.02413.70
5.4.170.0060.02713.72
5.4.160.0080.02813.85
5.4.150.0070.02913.68
5.4.140.0030.02912.91
5.4.130.0030.02612.86
5.4.120.0030.03012.79
5.4.110.0030.03112.89
5.4.100.0060.02512.94
5.4.90.0040.02512.94
5.4.80.0040.02912.97
5.4.70.0070.01612.83
5.4.60.0030.03012.97
5.4.50.0020.03012.81
5.4.40.0030.02912.81
5.4.30.0050.01512.92
5.4.20.0040.02812.86
5.4.10.0040.02012.96
5.4.00.0020.02712.59
5.3.290.0030.03311.75
5.3.280.0010.02811.72
5.3.270.0060.01911.63
5.3.260.0040.02511.77
5.3.250.0010.03211.72
5.3.240.0030.02611.70
5.3.230.0060.01611.69
5.3.220.0040.03111.75
5.3.210.0020.03011.67
5.3.200.0030.03011.70
5.3.190.0070.02811.74
5.3.180.0040.03111.76
5.3.170.0070.02711.75
5.3.160.0030.02811.73
5.3.150.0010.03011.85
5.3.140.0060.02611.70
5.3.130.0080.02611.78
5.3.120.0040.02911.75
5.3.110.0020.02311.81
5.3.100.0040.02611.63
5.3.90.0030.03011.59
5.3.80.0050.01711.58
5.3.70.0070.02711.44
5.3.60.0040.02911.59
5.3.50.0030.02511.46
5.3.40.0010.02411.54
5.3.30.0060.02611.45
5.3.20.0020.03011.39
5.3.10.0020.03011.37
5.3.00.0010.02611.34
5.2.170.0030.05311.06
5.2.160.0030.06011.04
5.2.150.0070.06011.16
5.2.140.0030.04711.26
5.2.130.0070.05011.21
5.2.120.0070.05311.09
5.2.110.0030.06011.24
5.2.100.0030.05711.16
5.2.90.0030.06011.09
5.2.80.0000.05011.15
5.2.70.0030.06311.21
5.2.60.0030.06310.97
5.2.50.0030.03710.88
5.2.40.0030.05711.06
5.2.30.0000.04011.11
5.2.20.0000.03711.07
5.2.10.0000.06310.96
5.2.00.0030.04310.65
5.1.60.0000.0579.88
5.1.50.0030.0509.85
5.1.40.0030.0509.98
5.1.30.0000.05310.48
5.1.20.0030.02710.22
5.1.10.0000.03010.11
5.1.00.0000.03310.09
5.0.50.0070.0338.61
5.0.40.0070.0378.41
5.0.30.0030.0638.41
5.0.20.0000.0238.41
5.0.10.0030.0438.41
5.0.00.0030.0608.41
4.4.90.0000.0338.41
4.4.80.0000.0378.41
4.4.70.0000.0338.41
4.4.60.0030.0238.41
4.4.50.0000.0278.41
4.4.40.0000.0308.41
4.4.30.0000.0308.41
4.4.20.0000.0278.41
4.4.10.0000.0178.41
4.4.00.0030.0508.41
4.3.110.0030.0338.41
4.3.100.0000.0308.41
4.3.90.0030.0338.41
4.3.80.0000.0278.41
4.3.70.0000.0308.41
4.3.60.0030.0338.41
4.3.50.0000.0308.41
4.3.40.0000.0508.41
4.3.30.0100.0278.41
4.3.20.0030.0378.41
4.3.10.0000.0378.41
4.3.00.0000.0208.41

preferences:
48.5 ms | 401 KiB | 5 Q