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() { echo $this->_total; return [ 'total' => $this->_total, 'tax_total' => ($this->_total / 100) * self::Tax ]; } } session_start(); $iezon = []; $iezon['payment'] = [ 'object' => new TaxReturn(), 'disclose' => [] ]; $iezon['payment']['object']->append(new Item('Some Id')); $iezon['payment']['disclose'] = $iezon['payment']['object']->retrieve(); echo 'Total (' . TaxReturn::TaxPercent . '%) : ' . $iezon['payment']['disclose']['tax_total'];

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.0120.00318.33
8.3.50.0120.00918.14
8.3.40.0150.00018.79
8.3.30.0040.01118.93
8.3.20.0030.00619.21
8.3.10.0000.00821.88
8.3.00.0080.00020.89
8.2.180.0090.00916.63
8.2.170.0110.00722.96
8.2.160.0100.00320.48
8.2.150.0000.00824.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0080.00020.97
8.2.110.0090.00022.26
8.2.100.0060.00617.78
8.2.90.0050.00317.87
8.2.80.0030.00518.16
8.2.70.0090.00017.93
8.2.60.0080.00018.12
8.2.50.0090.00018.10
8.2.40.0060.00320.46
8.2.30.0070.00019.54
8.2.20.0060.00318.17
8.2.10.0000.00818.27
8.2.00.0070.00017.72
8.1.280.0060.01325.92
8.1.270.0040.00424.66
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0090.00023.92
8.1.230.0060.00619.13
8.1.220.0050.00317.78
8.1.210.0030.00618.77
8.1.200.0090.00017.35
8.1.190.0060.00317.25
8.1.180.0050.00318.10
8.1.170.0040.00418.65
8.1.160.0000.00819.12
8.1.150.0000.00820.21
8.1.140.0040.00419.54
8.1.130.0030.00317.66
8.1.120.0040.00417.41
8.1.110.0090.00017.45
8.1.100.0000.00817.50
8.1.90.0030.00617.57
8.1.80.0030.00417.39
8.1.70.0070.00017.50
8.1.60.0040.00417.54
8.1.50.0090.00017.59
8.1.40.0000.00817.56
8.1.30.0000.00817.64
8.1.20.0030.00617.61
8.1.10.0000.00917.59
8.1.00.0060.00317.43
8.0.300.0030.00619.96
8.0.290.0000.00816.88
8.0.280.0000.00718.50
8.0.270.0040.00416.98
8.0.260.0000.00617.35
8.0.250.0000.00717.07
8.0.240.0070.00016.95
8.0.230.0050.00317.12
8.0.220.0040.00417.02
8.0.210.0000.00717.05
8.0.200.0030.00317.12
8.0.190.0000.00717.09
8.0.180.0040.00417.05
8.0.170.0040.00417.08
8.0.160.0000.00717.00
8.0.150.0000.01116.85
8.0.140.0000.00716.95
8.0.130.0030.00313.42
8.0.120.0040.00416.88
8.0.110.0040.00416.81
8.0.100.0080.00016.99
8.0.90.0030.00416.87
8.0.80.0130.00317.02
8.0.70.0040.00417.03
8.0.60.0040.00416.80
8.0.50.0000.00716.89
8.0.30.0090.00917.20
8.0.20.0110.00717.44
8.0.10.0080.00017.05
8.0.00.0090.00916.52
7.4.330.0000.00715.55
7.4.320.0000.00716.62
7.4.300.0040.00716.40
7.4.290.0000.00816.57
7.4.280.0030.00316.54
7.4.270.0070.00016.50
7.4.260.0030.00816.46
7.4.250.0040.00416.54
7.4.240.0000.00716.55
7.4.230.0030.00316.49
7.4.220.0190.00016.48
7.4.210.0040.01116.54
7.4.200.0030.00316.69
7.4.160.0100.00716.66
7.4.150.0100.00717.40
7.4.140.0100.01017.86
7.4.130.0070.01016.49
7.4.120.0130.00516.60
7.4.110.0040.01416.63
7.4.100.0140.00716.54
7.4.90.0100.00716.55
7.4.80.0140.00419.39
7.4.70.0100.00716.46
7.4.60.0060.01216.68
7.4.50.0040.01116.44
7.4.40.0080.00816.51
7.4.30.0090.00916.57
7.4.00.0090.00614.95
7.3.330.0030.00313.38
7.3.320.0030.00313.45
7.3.310.0050.00216.50
7.3.300.0000.00716.46
7.3.290.0070.00916.48
7.3.280.0100.00816.45
7.3.270.0110.00717.40
7.3.260.0070.01416.46
7.3.250.0110.00616.50
7.3.240.0100.01216.62
7.3.230.0030.01616.39
7.3.210.0000.01616.45
7.3.200.0040.01116.63
7.3.190.0060.01316.51
7.3.180.0080.00916.49
7.3.170.0120.00816.44
7.3.160.0060.01216.57
7.2.330.0080.00816.54
7.2.320.0090.01516.58
7.2.310.0030.01516.58
7.2.300.0070.01116.73
7.2.290.0030.01416.58
7.2.60.0030.01016.82
7.1.200.0060.00615.89
7.1.70.0000.00717.35
7.1.60.0030.01017.05
7.1.00.0030.07722.43
7.0.200.0040.00715.14
7.0.130.0070.05722.05
7.0.120.0030.06021.97
7.0.110.0000.06322.14
7.0.100.0100.05021.99
7.0.90.0100.05722.02
7.0.80.0070.08322.18
7.0.70.0100.05022.08
7.0.60.0030.05722.04
7.0.50.0070.07322.20
7.0.40.0070.05322.00
7.0.30.0100.05722.16
7.0.20.0130.05322.13
7.0.10.0130.05322.14
7.0.00.0230.06321.99
5.6.280.0030.08320.87
5.6.270.0100.05321.10
5.6.260.0130.04721.13
5.6.250.0170.05321.08
5.6.240.0130.05320.79
5.6.230.0130.05721.00
5.6.220.0130.04721.06
5.6.210.0030.06021.11
5.6.200.0100.05720.84
5.6.190.0000.06320.78
5.6.180.0170.05320.90
5.6.170.0170.05721.09
5.6.160.0130.06020.88
5.6.150.0000.07320.82
5.6.140.0130.06320.83
5.6.130.0170.07020.81
5.6.120.0100.07321.05
5.6.110.0130.07320.88
5.6.100.0100.05720.77
5.6.90.0070.05720.85
5.6.80.0100.05320.43
5.6.70.0070.05720.45
5.6.60.0170.05020.15
5.6.50.0130.05020.47
5.6.40.0070.05320.41
5.6.30.0130.05720.14
5.6.20.0170.06020.38
5.6.10.0200.04020.36
5.6.00.0000.06020.37

preferences:
30.35 ms | 400 KiB | 5 Q