3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Entity { private Decimal $subtotal; public function getSubtotal() { return $this->subtotal; } public function setSubtotal(Decimal $value) { $this->subtotal = $value; return $this; } } class Decimal { private string $value; public function __construct(string $value) { $this->value = $value; } public function getValue() { return $this->value; } public function toFixed(int $scale): Decimal { // rough example for adjusting precision - do not use return new self(bcadd($this->value, '0', $scale)); } } //////////////// $entity = new Entity(); $entity->setSubtotal((new Decimal('1337.987654321'))->toFixed(4)); echo $entity->getSubtotal()->getValue();

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.70.0080.00917.14
8.5.60.0060.00316.84
8.5.50.0110.00617.13
8.5.30.0090.00820.00
8.5.20.0100.00820.28
8.5.10.0110.00818.66
8.5.00.0140.00720.02
8.4.210.0120.00819.47
8.4.180.0130.00919.72
8.4.170.0140.01121.96
8.4.160.0050.00523.90
8.4.150.0070.00516.84
8.4.140.0140.00717.84
8.4.130.0110.00918.80
8.4.120.0050.00524.28
8.4.110.0110.01018.84
8.4.100.0100.00918.88
8.4.90.0090.00922.03
8.4.80.0040.00518.76
8.4.70.0090.00818.11
8.4.60.0100.01019.07
8.4.50.0120.00418.40
8.4.40.0210.00019.18
8.4.30.0100.00020.66
8.4.20.0170.00317.85
8.4.10.0060.00320.37
8.3.300.0110.00918.31
8.3.290.0120.00820.62
8.3.280.0160.00618.32
8.3.270.0090.01316.39
8.3.260.0130.00616.45
8.3.250.0110.00819.14
8.3.240.0130.00516.96
8.3.230.0120.00616.73
8.3.220.0050.00319.07
8.3.210.0100.00918.30
8.3.200.0080.00116.62
8.3.190.0140.00817.27
8.3.180.0040.00517.09
8.3.170.0070.01021.04
8.3.160.0090.00616.69
8.3.150.0060.01216.70
8.3.140.0000.00817.12
8.3.130.0140.00718.59
8.3.120.0090.01219.02
8.3.110.0000.00718.28
8.3.100.0090.00016.51
8.3.90.0000.00826.77
8.3.80.0100.00016.50
8.3.70.0120.00316.58
8.3.60.0090.00618.55
8.3.50.0070.00718.52
8.3.40.0120.00919.19
8.3.30.0080.00819.09
8.3.20.0070.00024.18
8.3.10.0000.00724.66
8.3.00.0080.00026.16
8.2.300.0120.00922.09
8.2.290.0130.00620.25
8.2.280.0070.00318.29
8.2.270.0080.01216.70
8.2.260.0080.01216.36
8.2.250.0140.00016.75
8.2.240.0080.00018.15
8.2.230.0080.00020.94
8.2.220.0050.00324.06
8.2.210.0120.00326.77
8.2.200.0030.00616.72
8.2.190.0150.00316.58
8.2.180.0000.01425.92
8.2.170.0210.00018.95
8.2.160.0070.00722.96
8.2.150.0040.00425.66
8.2.140.0000.00824.66
8.2.130.0070.00026.16
8.2.120.0000.00726.16
8.2.110.0000.00920.57
8.2.100.0080.00317.84
8.2.90.0030.00517.63
8.2.80.0000.00818.95
8.2.70.0000.00918.05
8.2.60.0000.00818.34
8.2.50.0030.00518.10
8.2.40.0000.00819.26
8.2.30.0030.00618.02
8.2.20.0040.00420.30
8.2.10.0070.00018.05
8.2.00.0050.00219.19
8.1.340.0130.00817.74
8.1.330.0130.00721.77
8.1.320.0110.00717.91
8.1.310.0030.00616.11
8.1.300.0090.00018.45
8.1.290.0090.00030.84
8.1.280.0090.00625.92
8.1.270.0040.00423.99
8.1.260.0050.00326.35
8.1.250.0000.00728.09
8.1.240.0070.00323.91
8.1.230.0110.00020.88
8.1.220.0000.00817.74
8.1.210.0000.00918.77
8.1.200.0040.00417.35
8.1.190.0050.00317.10
8.1.180.0050.00318.10
8.1.170.0000.00818.65
8.1.160.0000.00918.82
8.1.150.0030.00618.57
8.1.140.0000.00817.29
8.1.130.0000.00718.74
8.1.120.0040.00417.34
8.1.110.0050.00317.40
8.1.100.0050.00317.45
8.1.90.0030.00617.41
8.1.80.0060.00317.45
8.1.70.0030.00317.39
8.1.60.0030.00517.48
8.1.50.0000.00817.52
8.1.40.0030.00517.43
8.1.30.0040.00817.54
8.1.20.0030.00717.56
8.1.10.0040.00817.51
8.1.00.0110.00317.45
8.0.300.0070.00018.93
8.0.290.0060.00316.75
8.0.280.0000.00718.44
8.0.270.0030.00616.88
8.0.260.0000.00618.50
8.0.250.0000.00716.93
8.0.240.0030.00317.03
8.0.230.0000.01016.90
8.0.220.0030.00316.91
8.0.210.0070.00016.89
8.0.200.0000.00716.85
8.0.190.0000.00716.98
8.0.180.0000.00716.95
8.0.170.0130.00016.87
8.0.160.0040.00716.74
8.0.150.0070.00716.76
8.0.140.0110.00716.75
8.0.130.0150.00016.66
8.0.120.0110.00416.85
8.0.110.0110.00816.80
8.0.100.0170.00016.85
8.0.90.0080.00816.91
8.0.80.0070.00716.75
8.0.70.0060.01016.84
8.0.60.0130.00216.78
8.0.50.0120.00416.84
8.0.30.0040.00816.88
8.0.20.0080.00816.98
8.0.10.0170.00216.95
7.4.330.0030.00315.55
7.4.320.0080.00016.44
7.4.300.0070.00016.51
7.4.290.0040.00416.56
7.4.280.0250.00016.41
7.4.270.0070.01016.45
7.4.260.0110.00216.42
7.4.250.0110.00816.57
7.4.240.0170.00416.58
7.4.230.0160.00916.47
7.4.220.0210.00016.34
7.4.210.0180.00016.54
7.4.200.0100.00316.36
7.4.190.0160.00416.61
7.4.180.0160.00416.47
7.4.160.0180.00316.53
7.4.150.0090.01216.45
7.4.140.0160.00316.43
7.4.130.0170.00316.40
7.4.120.0170.00316.47
7.4.110.0110.00816.41
7.4.100.0170.00316.34
7.4.90.0160.00316.34
7.4.80.0130.00716.45
7.4.70.0150.00516.29
7.4.60.0180.00316.42
7.4.50.0130.00516.21
7.4.40.0110.00416.37
7.4.30.0100.00416.23
7.4.20.0160.00016.23
7.4.10.0140.00516.45
7.4.00.0100.00616.34

preferences:
830.13 ms | 1250 KiB | 5 Q