3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * * @author Kyle @ Iezon * @copyright (c) 2016 - 2017, Iezon * * Controller for Tax and Payments * **/ namespace Iezon\Products; class Item { public function __construct($product_id) { // load product from database } public function cost() { return 1000; } } class TaxReturn { const Tax = 0.2; const TaxPercent = 20; private $_total = 0; private $_item = []; public function __construct() { $stored = $_SESSION['total']; if(empty($stored)) return; $this->_total = $stored; } public function append(Item $item) { $this->_item[] = $item; $this->_total = $this->_total + $item->cost(); return $this; } public function retrieve() { return [ 'total' => $this->_total, 'tax_total' => (($this->_total / 100) * self::Tax) + $this->_total ]; } } session_start(); $iezon = []; $iezon['payment'] = [ 'object' => new TaxReturn(), 'disclose' => [] ]; $iezon['payment']['object']->append(new Item('Some Id')); $iezon['payment']['disclose'] = $iezon['payment']['object']->retrieve(); $money = $iezon['payment']['disclose']['tax_total']; echo 'Total (' . TaxReturn::TaxPercent . '%) : ' . number_format(($money /100), 2, '.', ' ');

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.40.0090.00619.09
8.3.30.0090.00919.00
8.3.20.0080.00019.23
8.3.10.0080.00022.02
8.3.00.0050.00321.06
8.2.170.0120.00622.96
8.2.160.0100.00320.60
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0040.00419.82
8.2.120.0050.00326.35
8.2.110.0090.00021.04
8.2.100.0040.00817.84
8.2.90.0080.00019.20
8.2.80.0030.00618.16
8.2.70.0040.00417.75
8.2.60.0080.00017.75
8.2.50.0030.00517.75
8.2.40.0000.00818.28
8.2.30.0040.00418.23
8.2.20.0040.00418.32
8.2.10.0040.00418.29
8.2.00.0080.00017.93
8.1.270.0040.00422.20
8.1.260.0040.00428.09
8.1.250.0100.00028.09
8.1.240.0070.00322.79
8.1.230.0070.00418.07
8.1.220.0060.00317.79
8.1.210.0040.00418.77
8.1.200.0030.00617.59
8.1.190.0060.00317.88
8.1.180.0050.00318.10
8.1.170.0000.00819.00
8.1.160.0000.00719.00
8.1.150.0050.00319.07
8.1.140.0000.00719.75
8.1.130.0000.00717.80
8.1.120.0000.00717.55
8.1.110.0000.00817.61
8.1.100.0000.00817.54
8.1.90.0040.00417.56
8.1.80.0040.00417.63
8.1.70.0000.00817.52
8.1.60.0030.00617.60
8.1.50.0030.00617.55
8.1.40.0000.00817.65
8.1.30.0040.00417.62
8.1.20.0050.00317.69
8.1.10.0050.00317.70
8.1.00.0030.00617.53
8.0.300.0000.00818.77
8.0.290.0050.00317.00
8.0.280.0000.00718.58
8.0.270.0040.00417.35
8.0.260.0000.00817.43
8.0.250.0080.00017.06
8.0.240.0020.00517.11
8.0.230.0030.00617.11
8.0.220.0050.00217.02
8.0.210.0040.00417.11
8.0.200.0000.00717.14
8.0.190.0060.00317.14
8.0.180.0000.00817.02
8.0.170.0000.00817.18
8.0.160.0040.00417.07
8.0.150.0110.00016.82
8.0.140.0040.00417.07
8.0.130.0000.00513.54
8.0.120.0060.00317.01
8.0.110.0000.00817.13
8.0.100.0040.00417.05
8.0.90.0080.00017.09
8.0.80.0130.01316.97
8.0.70.0000.00916.95
8.0.60.0070.00016.93
8.0.50.0050.00217.10
8.0.30.0110.00917.23
8.0.20.0140.00517.40
8.0.10.0060.00317.24
8.0.00.0000.02616.94
7.4.330.0070.00015.55
7.4.320.0000.00616.64
7.4.300.0060.00516.65
7.4.290.0030.00516.65
7.4.280.0040.00416.57
7.4.270.0000.00716.62
7.4.260.0070.00016.68
7.4.250.0070.00016.74
7.4.240.0040.00416.77
7.4.230.0000.00716.74
7.4.220.0150.00316.70
7.4.210.0060.00916.84
7.4.200.0070.00016.54
7.4.160.0100.00816.68
7.4.150.0040.01417.40
7.4.140.0130.00617.86
7.4.130.0100.00816.65
7.4.120.0090.01016.65
7.4.110.0030.01416.69
7.4.100.0070.01416.55
7.4.90.0090.00916.67
7.4.80.0070.01019.39
7.4.70.0110.00616.70
7.4.60.0060.01016.57
7.4.50.0100.00716.62
7.4.40.0060.01216.68
7.4.30.0050.01416.48
7.4.00.0060.00914.96
7.3.330.0000.00513.54
7.3.320.0000.00613.45
7.3.310.0000.00716.38
7.3.300.0050.00216.40
7.3.290.0090.00716.51
7.3.280.0090.01016.54
7.3.270.0060.01217.40
7.3.260.0140.00616.61
7.3.250.0090.00916.61
7.3.240.0100.00916.54
7.3.230.0080.00816.55
7.3.210.0100.00716.52
7.3.200.0130.00716.57
7.3.190.0090.00616.81
7.3.180.0100.00716.72
7.3.170.0110.00616.59
7.3.160.0100.01316.54
7.2.330.0030.01616.61
7.2.320.0190.00616.87
7.2.310.0060.01516.65
7.2.300.0100.01116.50
7.2.290.0140.00616.75
7.2.60.0060.00617.08
7.1.200.0200.00915.17
7.1.70.0040.00417.22
7.1.60.0030.00716.96
7.1.00.0030.07722.45
7.0.200.0070.00416.80
7.0.130.0130.05022.11
7.0.120.0130.05322.15
7.0.110.0130.05022.10
7.0.100.0000.06721.96
7.0.90.0030.08322.14
7.0.80.0170.05021.98
7.0.70.0200.04722.08
7.0.60.0070.06722.11
7.0.50.0100.06322.21
7.0.40.0100.05722.16
7.0.30.0030.06321.99
7.0.20.0100.05321.99
7.0.10.0030.06322.16
7.0.00.0070.06022.18
5.6.280.0070.05320.82
5.6.270.0070.07321.12
5.6.260.0000.06021.09
5.6.250.0130.05020.94
5.6.240.0170.05321.14
5.6.230.0170.05320.93
5.6.220.0130.05321.15
5.6.210.0070.07721.04
5.6.200.0170.05721.06
5.6.190.0070.06020.89
5.6.180.0130.06721.05
5.6.170.0100.05721.05
5.6.160.0100.05321.04
5.6.150.0200.05321.09
5.6.140.0000.06720.89
5.6.130.0030.05720.89
5.6.120.0100.05720.83
5.6.110.0170.06720.99
5.6.100.0070.05720.82
5.6.90.0070.05720.91
5.6.80.0100.05020.28
5.6.70.0170.04320.15
5.6.60.0100.05320.44
5.6.50.0030.07320.37
5.6.40.0000.05720.42
5.6.30.0070.06720.45
5.6.20.0070.06720.42
5.6.10.0000.05720.27
5.6.00.0000.05720.41

preferences:
51.94 ms | 400 KiB | 5 Q