3v4l.org

run code in 300+ PHP versions simultaneously
<?php class product { public function getData($key){ return ['total' => rand(1,999)]; } } class Mage { public static function getModel($name){ $class = __CLASS__; return new $class; } public function load($id){ return new product; } } class item { public function getProductId(){ return rand(1, 999); } } class order { public function getAllItems(){ return [new item, new item, new item]; } } $order = new order; $totalprofit = 0; foreach($order->getAllItems() as $item): $product = Mage::getModel('catalog/product')->load($item->getProductId()); $profit = $product->getData('profit'); $totalprofit += $profit['total']; echo $profit['total'], "\n"; endforeach; echo $totalprofit, "\n"; ?>

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)
7.4.10.0120.00414.63
7.4.00.0040.01415.27
7.3.130.0150.00415.08
7.3.120.0090.00614.94
7.3.110.0110.00714.78
7.3.100.0110.00414.79
7.3.90.0100.00014.93
7.3.80.0070.00715.02
7.3.70.0030.01415.04
7.3.60.0040.01214.55
7.3.50.0060.00914.89
7.3.40.0110.00414.92
7.3.30.0090.00615.02
7.3.20.0040.00816.73
7.3.10.0040.01116.91
7.3.00.0030.01016.69
7.2.260.0100.01014.96
7.2.250.0070.01315.32
7.2.240.0060.00915.40
7.2.230.0030.01315.05
7.2.220.0040.00914.82
7.2.210.0030.00915.30
7.2.200.0040.01115.04
7.2.190.0100.00715.20
7.2.180.0080.00815.25
7.2.170.0090.00614.97
7.2.160.0050.00515.14
7.2.150.0030.01017.10
7.2.140.0030.01316.92
7.2.130.0040.01116.88
7.2.120.0060.00917.08
7.2.110.0130.00016.88
7.2.100.0100.00716.85
7.2.90.0030.01016.81
7.2.80.0040.01117.14
7.2.70.0120.00617.05
7.2.60.0040.01116.68
7.2.50.0000.01416.77
7.2.40.0040.01116.98
7.2.30.0100.00017.09
7.2.20.0060.00917.09
7.2.10.0040.00816.96
7.2.00.0040.00816.96
7.1.330.0060.00916.05
7.1.320.0070.00415.84
7.1.310.0070.00715.91
7.1.300.0100.00315.88
7.1.290.0000.00915.90
7.1.280.0100.00315.60
7.1.270.0030.00915.94
7.1.260.0070.00715.75
7.1.250.0040.01115.98
7.1.240.0060.00915.77
7.1.230.0030.01215.66
7.1.220.0070.00715.71
7.1.210.0100.00315.84
7.1.200.0060.00615.95
7.1.190.0100.00315.78
7.1.180.0000.01215.65
7.1.170.0030.00615.73
7.1.160.0030.01015.82
7.1.150.0000.01015.77
7.1.140.0110.00315.73
7.1.130.0040.00815.52
7.1.120.0120.00315.77
7.1.110.0100.00315.50
7.1.100.0100.00815.91
7.1.90.0090.00916.02
7.1.80.0140.00615.75
7.1.70.0110.00815.52
7.1.60.0580.00524.41
7.1.50.0840.00624.22
7.1.40.0490.00624.13
7.1.30.0330.00924.14
7.1.20.3410.01024.30
7.1.10.5540.01315.31
7.1.00.4460.00915.13
7.0.330.0080.00015.55
7.0.320.0040.01115.57
7.0.310.0000.01115.20
7.0.300.0030.01315.38
7.0.290.0000.01415.40
7.0.280.0060.00615.63
7.0.270.0060.00615.38
7.0.260.0060.00915.20
7.0.250.0000.01415.37
7.0.240.0130.00615.72
7.0.230.0080.00915.70
7.0.220.0080.01215.62
7.0.210.0640.01615.25
7.0.200.5670.01115.24
7.0.190.0810.01015.18
7.0.180.1030.00914.97
7.0.170.4530.00815.01
7.0.160.5780.00715.05
7.0.150.3330.00714.98
7.0.140.3250.00815.18
7.0.130.4480.01115.07
7.0.120.4230.01015.08
7.0.110.4440.01214.99
7.0.100.1350.01015.00
7.0.90.0110.00814.99
7.0.80.0060.01415.14
7.0.70.1250.01314.93
7.0.60.0070.01014.84
7.0.50.0090.00915.21
7.0.40.0910.00713.94
7.0.30.0130.00413.99
7.0.20.0060.01014.08
7.0.10.0110.00913.86
7.0.00.0080.01013.93
5.6.400.0060.00614.50
5.6.390.0030.01114.40
5.6.380.0060.00914.43
5.6.370.0030.01314.67
5.6.360.0100.00714.58
5.6.350.0090.00014.34
5.6.340.0000.01614.40
5.6.330.0080.00514.48
5.6.320.0060.00314.34
5.6.310.0070.00314.52
5.6.300.0120.00614.42
5.6.290.0120.00314.07
5.6.280.0060.00614.55
5.6.270.0040.00414.31
5.6.260.0030.01314.17
5.6.250.0080.00314.66
5.6.240.0080.00814.48
5.6.230.0070.00714.57
5.6.220.0080.00814.73
5.6.210.0000.01414.74
5.6.200.0000.01414.36
5.6.190.0030.00614.41
5.6.180.0070.00714.38
5.6.170.0040.01114.54
5.6.160.0040.01114.16
5.6.150.0040.00814.45
5.6.140.0060.00914.63
5.6.130.0040.01114.61
5.6.120.0120.00614.52
5.6.110.0110.00614.32
5.6.100.0070.00414.65
5.6.90.0110.00414.32
5.6.80.0030.01314.41
5.6.70.0060.00314.41
5.6.60.0070.00714.37
5.6.50.0000.01414.15
5.6.40.0040.01114.33
5.6.30.0000.01714.29
5.6.20.0060.00614.38
5.6.10.0090.00614.05
5.6.00.0040.00814.35

preferences:
34.42 ms | 401 KiB | 5 Q