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(); 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.68
8.3.50.0210.00418.14
8.3.40.0060.00919.14
8.3.30.0140.00018.92
8.3.20.0000.01419.14
8.3.10.0030.00521.89
8.3.00.0040.00420.90
8.2.180.0130.00616.88
8.2.170.0110.00418.85
8.2.160.0100.00322.96
8.2.150.0040.00425.66
8.2.140.0080.00024.66
8.2.130.0080.00020.07
8.2.120.0000.00826.35
8.2.110.0060.00322.34
8.2.100.0070.01018.03
8.2.90.0040.00417.63
8.2.80.0050.00318.84
8.2.70.0030.00617.75
8.2.60.0000.00818.16
8.2.50.0060.00319.47
8.2.40.0070.00020.59
8.2.30.0080.00019.41
8.2.20.0000.00718.14
8.2.10.0000.00718.17
8.2.00.0040.00417.95
8.1.280.0180.00025.92
8.1.270.0030.00523.96
8.1.260.0040.00428.09
8.1.250.0030.00528.09
8.1.240.0000.00920.81
8.1.230.0070.00417.89
8.1.220.0040.00417.80
8.1.210.0030.00518.77
8.1.200.0050.00317.35
8.1.190.0090.00017.25
8.1.180.0080.00018.10
8.1.170.0040.00418.67
8.1.160.0040.00419.01
8.1.150.0040.00420.38
8.1.140.0040.00419.58
8.1.130.0000.00717.72
8.1.120.0000.00717.52
8.1.110.0030.00617.50
8.1.100.0070.00017.46
8.1.90.0050.00317.54
8.1.80.0040.00417.43
8.1.70.0070.00017.39
8.1.60.0000.00817.55
8.1.50.0060.00317.58
8.1.40.0050.00317.56
8.1.30.0040.00417.68
8.1.20.0040.00417.68
8.1.10.0000.00817.66
8.1.00.0040.00417.46
8.0.300.0090.00018.99
8.0.290.0090.00016.88
8.0.280.0030.00318.45
8.0.270.0000.00917.35
8.0.260.0030.00317.31
8.0.250.0070.00016.94
8.0.240.0030.00316.98
8.0.230.0040.00416.93
8.0.220.0000.00716.94
8.0.210.0030.00316.93
8.0.200.0000.00716.95
8.0.190.0040.00417.05
8.0.180.0050.00317.04
8.0.170.0040.00417.05
8.0.160.0070.00016.89
8.0.150.0060.00617.03
8.0.140.0000.00716.91
8.0.130.0060.00013.37
8.0.120.0060.00316.86
8.0.110.0020.00517.06
8.0.100.0040.00416.85
8.0.90.0040.00417.11
8.0.80.0030.01217.03
8.0.70.0080.00016.89
8.0.60.0040.00417.04
8.0.50.0080.00017.09
8.0.30.0100.00817.32
8.0.20.0070.01117.40
8.0.10.0040.00416.99
8.0.00.0120.00516.96
7.4.330.0040.00415.55
7.4.320.0070.00016.66
7.4.300.0100.00216.56
7.4.290.0060.00316.64
7.4.280.0040.00416.55
7.4.270.0030.00316.53
7.4.260.0000.00716.68
7.4.250.0030.00316.56
7.4.240.0000.00716.54
7.4.230.0040.00416.71
7.4.220.0070.01216.64
7.4.210.0090.00616.48
7.4.200.0040.00416.55
7.4.160.0100.00616.70
7.4.150.0070.01017.40
7.4.140.0100.01017.86
7.4.130.0120.00516.46
7.4.120.0150.00516.60
7.4.110.0100.00716.50
7.4.100.0040.01316.61
7.4.90.0120.00616.50
7.4.80.0080.00819.39
7.4.70.0060.01016.55
7.4.60.0070.01016.43
7.4.50.0080.00416.63
7.4.40.0100.00716.70
7.4.30.0160.00616.54
7.4.00.0100.00514.95
7.3.330.0000.00513.38
7.3.320.0030.00313.27
7.3.310.0000.00816.46
7.3.300.0040.00416.43
7.3.290.0080.00716.41
7.3.280.0120.00616.46
7.3.270.0040.01517.40
7.3.260.0060.01316.58
7.3.250.0110.00616.43
7.3.240.0080.01416.61
7.3.230.0130.00616.43
7.3.210.0100.00716.69
7.3.200.0110.00716.51
7.3.190.0130.00316.45
7.3.180.0060.01116.39
7.3.170.0060.01216.61
7.3.160.0100.01016.41
7.3.120.0060.01015.03
7.3.110.0090.00915.05
7.3.100.0040.01515.17
7.3.90.0090.00615.13
7.3.80.0030.00615.04
7.3.70.0060.00714.81
7.3.60.0000.01214.57
7.3.50.0120.00414.91
7.3.40.0030.01514.96
7.3.30.0060.00614.58
7.3.20.0000.01416.86
7.3.10.0040.00816.76
7.3.00.0030.01116.73
7.2.330.0070.01016.71
7.2.320.0060.01316.60
7.2.310.0110.00616.86
7.2.300.0060.01616.73
7.2.290.0070.01516.87
7.2.250.0060.01214.99
7.2.240.0100.00715.29
7.2.230.0030.01215.18
7.2.220.0030.01015.32
7.2.210.0120.00015.37
7.2.200.0090.00614.89
7.2.190.0060.01015.07
7.2.180.0060.00615.08
7.2.170.0060.01015.29
7.2.160.0040.01115.11
7.2.150.0030.00717.00
7.2.140.0030.01017.13
7.2.130.0030.01417.20
7.2.120.0070.00717.06
7.2.110.0030.00716.84
7.2.100.0000.01417.18
7.2.90.0070.01017.11
7.2.80.0040.01116.89
7.2.70.0030.01016.83
7.2.60.0150.00517.00
7.2.50.0060.00917.01
7.2.40.0090.00617.16
7.2.30.0120.00317.08
7.2.20.0040.01117.00
7.2.10.0000.01416.78
7.2.00.0050.00516.97
7.1.330.0030.01015.88
7.1.320.0110.00415.88
7.1.310.0040.00415.88
7.1.300.0040.01115.79
7.1.290.0000.01015.79
7.1.280.0040.01115.83
7.1.270.0060.00315.88
7.1.260.0030.01016.04
7.1.250.0040.00716.07
7.1.240.0060.00615.91
7.1.230.0030.01215.94
7.1.220.0060.00915.95
7.1.210.0030.00715.92
7.1.200.0050.00715.86
7.1.190.0030.01115.64
7.1.180.0000.00915.93
7.1.170.0030.00615.69
7.1.160.0030.00615.83
7.1.150.0120.00615.92
7.1.140.0030.00715.65
7.1.130.0080.00415.87
7.1.120.0030.00915.58
7.1.110.0090.00615.71
7.1.100.0100.00315.86
7.1.90.0000.01416.00
7.1.80.0030.01415.68
7.1.70.0050.00416.46
7.1.60.0060.00616.47
7.1.50.0000.01415.79
7.1.40.0000.01315.91
7.1.30.0040.00415.86
7.1.20.0000.01415.81
7.1.10.0060.00715.75
7.1.00.0030.04219.20
7.0.330.0060.00315.55
7.0.320.0040.00415.43
7.0.310.0030.01015.39
7.0.300.0000.01215.43
7.0.290.0060.00315.26
7.0.280.0060.00615.35
7.0.270.0070.00715.53
7.0.260.0030.00915.42
7.0.250.0000.00915.66
7.0.240.0070.01015.39
7.0.230.0100.00715.34
7.0.220.0070.00715.48
7.0.210.0040.00415.59
7.0.200.0150.00715.18
7.0.190.0060.00615.35
7.0.180.0000.01515.53
7.0.170.0060.00315.57
7.0.160.0040.01115.25
7.0.150.0080.00315.34
7.0.140.0000.01615.23
7.0.130.0070.03218.86
7.0.120.0100.03718.72
7.0.110.0080.02818.84
7.0.100.0100.03918.86
7.0.90.0080.03318.68
7.0.80.0080.03218.88
7.0.70.0050.03418.74
7.0.60.0070.03218.77
7.0.50.0100.03518.91
7.0.40.0080.03717.86
7.0.30.0030.04117.67
7.0.20.0080.03017.68
7.0.10.0090.02917.94
7.0.00.0030.03517.91
5.6.400.0040.01214.83
5.6.390.0120.00614.77
5.6.380.0040.00414.81
5.6.370.0030.00614.63
5.6.360.0070.01014.54
5.6.350.0090.00614.41
5.6.340.0120.00014.49
5.6.330.0090.00614.52
5.6.320.0060.00314.33
5.6.310.0040.00814.66
5.6.300.0040.01114.68
5.6.290.0090.00314.36
5.6.280.0130.03317.84
5.6.270.0070.03817.71
5.6.260.0080.02817.66
5.6.250.0030.03517.86
5.6.240.0060.04217.81
5.6.230.0050.03717.72
5.6.220.0080.03217.70
5.6.210.0070.03517.79
5.6.200.0030.03617.57
5.6.190.0110.03517.63
5.6.180.0170.03617.81
5.6.170.0060.04117.76
5.6.160.0070.03017.70
5.6.150.0070.03917.59
5.6.140.0080.03117.62
5.6.130.0020.04417.54
5.6.120.0100.02817.61
5.6.110.0080.04217.66
5.6.100.0090.03217.60
5.6.90.0100.03017.87
5.6.80.0120.02517.41
5.6.70.0070.02817.43
5.6.60.0020.03417.39
5.6.50.0000.03217.42
5.6.40.0070.03117.30
5.6.30.0070.03417.28
5.6.20.0090.03217.34
5.6.10.0100.02817.34
5.6.00.0070.03117.35

preferences:
66.47 ms | 401 KiB | 5 Q