3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo 'start'; function recuperation_info_product_et_decrementation($reference, $qty, $isDeclinaison){ /* Fonction de récupèration et décrementation produit */ $product_infos = array(); $tables = array('product_attribute'); if($isDeclinaison === false) { array_unshift($tables, 'product'); } foreach($tables as $table) { $query = 'SELECT * FROM `'._DB_PREFIX_.$table.'` WHERE `reference` = "'.$reference.'";'; $result = Db::getInstance()->executeS($query); if($result !== false) { $product_infos = $result[0]; decremente_stock($product_infos['id_product'], $qty, $reference, $table); //break; } } return $product_infos; } /* fonction qui retourne l'IdProduct et l'IdProductAttribute du produit commandé */ function recuperation_idProduct_idProductAttribute($reference){ $product_infos = array(); $query = 'SELECT * FROM `'._DB_PREFIX_.'product` WHERE `reference` = "'.pSQL($reference).'";'; $result = Db::getInstance()->executeS($query); $product_infos['id_product'] = $result[0]['id_product']; $query = 'SELECT * FROM `'._DB_PREFIX_.'product_attribute` WHERE `reference` = "'.pSQL($reference).'";'; $result = Db::getInstance()->executeS($query); $product_infos['id_product_attribute'] = $result[0]['id_product_attribute']; return $product_infos; } function decremente_stock($id_product, $qty, $reference, $table) { global $version_sup_egale_1531; switch ($GLOBALS['versionPourSwitch']){ case '1.5.4.0': // [-] Core: Hook actionUpdateQuantity was not called for product without attributes which depends on the physical stock $query = ' UPDATE `'._DB_PREFIX_.'stock_available` SET quantity = (quantity - "'.$qty.'") WHERE id_product = "'.$id_product.'" AND `reference` = "'.$reference.'";'; Db::getInstance()->execute($query); $query2 = ' UPDATE `'._DB_PREFIX_.'stock` SET physical_quantity = (physical_quantity - "'.$qty.'") WHERE id_product = "'.$id_product.'" AND `reference` = "'.$reference.'";'; Db::getInstance()->execute($query2); break; default: if($version_sup_egale_1531) { $query = ' UPDATE `'._DB_PREFIX_.'stock_available` SET quantity = (quantity - "'.$qty.'") WHERE id_product = "'.$id_product.'" AND `reference` = "'.$reference.'";'; } else { $query = ' UPDATE `'._DB_PREFIX_.$table.'` SET quantity = (quantity - "'.$qty.'") WHERE id_product = "'.$id_product.'" AND `reference` = "'.$reference.'";'; } Db::getInstance()->execute($query); break; } } echo 'done';

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.0160.00316.75
8.3.50.0070.01418.16
8.3.40.0120.00618.71
8.3.30.0110.00319.06
8.3.20.0040.00420.16
8.3.10.0000.00823.43
8.3.00.0040.00419.26
8.2.180.0060.01218.16
8.2.170.0140.00722.96
8.2.160.0100.00320.45
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0000.00826.16
8.2.120.0070.00022.24
8.2.110.0060.00322.08
8.2.100.0090.00317.59
8.2.90.0050.00319.23
8.2.80.0040.00417.97
8.2.70.0060.00317.50
8.2.60.0000.00917.93
8.2.50.0090.00018.07
8.2.40.0030.00519.76
8.2.30.0050.00218.01
8.2.20.0000.00717.63
8.2.10.0040.00418.07
8.2.00.0100.00017.69
8.1.270.0040.00423.66
8.1.260.0000.00826.35
8.1.250.0000.00728.09
8.1.240.0030.00623.97
8.1.230.0070.00419.28
8.1.220.0040.00417.74
8.1.210.0080.00018.77
8.1.200.0090.00017.13
8.1.190.0040.00417.53
8.1.180.0100.00318.10
8.1.170.0080.00018.78
8.1.160.0000.00821.91
8.1.150.0040.00418.69
8.1.140.0000.00717.30
8.1.130.0090.00017.77
8.1.120.0040.00417.43
8.1.110.0040.00417.42
8.1.100.0030.00517.38
8.1.90.0000.00717.42
8.1.80.0070.00017.41
8.1.70.0070.00017.35
8.1.60.0080.00017.43
8.1.50.0030.00617.47
8.1.40.0020.00517.39
8.1.30.0040.00417.43
8.1.20.0030.00517.56
8.1.10.0040.00417.40
8.1.00.0080.00017.38
8.0.300.0040.00420.85
8.0.290.0000.00717.30
8.0.280.0040.00418.58
8.0.270.0040.00417.21
8.0.260.0030.00617.27
8.0.250.0040.00416.86
8.0.240.0000.00716.82
8.0.230.0000.00716.92
8.0.220.0000.00716.88
8.0.210.0070.00016.75
8.0.200.0000.00616.90
8.0.190.0040.00416.88
8.0.180.0070.00016.79
8.0.170.0070.00016.88
8.0.160.0060.00316.97
8.0.150.0070.00016.75
8.0.140.0050.00516.69
8.0.130.0030.00313.14
8.0.120.0080.00016.64
8.0.110.0080.00016.83
8.0.100.0000.00716.75
8.0.90.0000.00716.77
8.0.80.0070.01016.87
8.0.70.0030.00316.91
8.0.60.0000.00816.91
8.0.50.0030.00516.80
8.0.30.0090.00916.85
8.0.20.0150.00417.40
8.0.10.0050.00216.99
8.0.00.0080.01116.74
7.4.330.0020.00215.00
7.4.320.0030.00316.59
7.4.300.0030.00316.45
7.4.290.0030.00316.45
7.4.280.0080.00016.47
7.4.270.0050.00216.60
7.4.260.0000.00816.46
7.4.250.0040.00416.41
7.4.240.0030.00416.52
7.4.230.0050.00316.45
7.4.220.0080.00816.38
7.4.210.0090.00716.55
7.4.200.0070.00016.48
7.4.190.0050.00216.62
7.4.160.0150.00616.45
7.4.150.0110.00717.40
7.4.140.0170.00317.86
7.4.130.0120.00816.43
7.4.120.0080.00916.44
7.4.110.0130.00316.61
7.4.100.0090.00916.55
7.4.90.0150.00316.39
7.4.80.0060.01219.39
7.4.70.0090.00716.44
7.4.60.0080.00916.38
7.4.50.0000.00816.39
7.4.40.0100.00722.77
7.4.30.0100.00716.16
7.4.00.0120.00514.89
7.3.330.0050.00013.10
7.3.320.0020.00213.24
7.3.310.0030.00416.33
7.3.300.0000.00716.30
7.3.290.0040.00916.22
7.3.280.0090.01016.17
7.3.270.0030.01317.40
7.3.260.0110.01216.36
7.3.250.0100.01316.35
7.3.240.0190.00416.41
7.3.230.0120.01216.43
7.3.210.0000.01716.09
7.3.200.0130.00719.39
7.3.190.0060.01216.27
7.3.180.0070.00716.41
7.3.170.0070.01316.32
7.3.160.0100.00716.18
7.3.120.0030.01314.87
7.3.110.0070.01015.01
7.3.100.0060.00914.90
7.3.90.0030.00614.79
7.3.80.0070.01014.94
7.3.70.0080.00014.79
7.3.60.0070.00414.87
7.3.50.0040.01114.78
7.3.40.0060.00314.63
7.3.30.0060.00614.82
7.3.20.0030.01016.39
7.3.10.0060.00616.69
7.3.00.0130.00316.51
7.2.330.0110.00716.44
7.2.320.0090.01116.64
7.2.310.0100.01016.48
7.2.300.0130.00316.50
7.2.290.0120.01216.34
7.2.250.0030.01314.61
7.2.240.0070.01315.02
7.2.230.0040.00815.19
7.2.220.0000.00815.17
7.2.210.0000.01414.97
7.2.200.0000.01414.92
7.2.190.0000.01314.64
7.2.180.0030.00914.85
7.2.170.0090.00314.88
7.2.00.0040.00819.08
7.1.330.0070.00715.42
7.1.320.0080.00415.33
7.1.310.0040.01115.47
7.1.300.0070.00715.77
7.1.290.0030.00615.66
7.1.280.0060.00615.59
7.1.270.0040.01115.68
7.1.260.0100.00615.54
7.1.100.0560.01315.86
7.1.70.0060.00317.09
7.1.60.0030.02119.46
7.1.50.0060.01616.60
7.1.00.0070.09322.35
7.0.200.0040.00416.51
7.0.140.0070.07322.21
7.0.60.0030.04020.01
7.0.50.0030.08017.93
7.0.40.0030.06320.40
7.0.30.0430.05020.21
7.0.20.0300.07320.16
7.0.10.0070.04020.15
7.0.00.0070.04720.20
5.6.280.0000.07721.09
5.6.210.0070.08320.54
5.6.200.0000.07318.18
5.6.190.0070.05020.63
5.6.180.0030.04720.48
5.6.170.0230.04020.71
5.6.160.0100.04020.46
5.6.150.0070.04018.18
5.6.140.0000.09018.18
5.6.130.0030.07018.14
5.6.120.0070.06321.00
5.6.110.0070.04321.10
5.6.100.0170.08021.00
5.6.90.0070.06721.02
5.6.80.0030.08320.42
5.5.350.0100.08020.51
5.5.340.0030.04018.09
5.5.330.0030.09020.41
5.5.320.0300.05320.25
5.5.310.0170.04720.27
5.5.300.0000.04017.97
5.5.290.0000.04318.08
5.5.280.0000.05320.99
5.5.270.0030.04720.79
5.5.260.0030.04020.66
5.5.250.0070.06020.57
5.5.240.0100.03720.22
5.4.450.0200.07719.30
5.4.440.0270.03319.57
5.4.430.0130.06019.32
5.4.420.0200.04319.52
5.4.410.0270.07719.33
5.4.400.0170.05019.06
5.4.390.0170.04018.95
5.4.380.0300.03318.98
5.4.370.0400.05719.18
5.4.360.0170.04719.00
5.4.350.0230.03319.22
5.4.340.0270.07019.24
5.4.320.0300.05019.22
5.4.310.0270.04018.99
5.4.300.0170.04319.08
5.4.290.0300.04719.24
5.4.280.0060.03612.39
5.4.270.0070.03612.39
5.4.260.0080.03912.40
5.4.250.0090.05712.40
5.4.240.0080.05212.39
5.4.230.0100.05012.39
5.4.220.0100.03912.39
5.4.210.0080.04412.38
5.4.200.0030.04312.39
5.4.190.0070.04112.39
5.4.180.0060.04112.38
5.4.170.0080.04112.39
5.4.160.0230.04612.39
5.4.150.0100.03612.38
5.4.140.0060.04012.06
5.4.130.0070.03912.06
5.4.120.0060.04112.01
5.4.110.0060.03812.01
5.4.100.0050.03712.01
5.4.90.0060.04312.01
5.4.80.0090.04412.01
5.4.70.0070.04412.00
5.4.60.0080.05112.00
5.4.50.0070.05312.00
5.4.40.0080.05112.00
5.4.30.0090.04911.99
5.4.20.0140.04511.99
5.4.10.0060.05111.99
5.4.00.0070.05911.48
5.3.290.4370.03314.59
5.3.280.0110.04012.71
5.3.270.0050.04512.72
5.3.260.0110.05412.72
5.3.250.0160.05312.72
5.3.240.0070.04412.72
5.3.230.0120.04912.71
5.3.220.0110.03612.68
5.3.210.0100.04212.68
5.3.200.0110.03512.68
5.3.190.0110.03612.68
5.3.180.0140.04612.68
5.3.170.0090.05112.67
5.3.160.0130.03512.67
5.3.150.0110.05612.67
5.3.140.0090.05312.66
5.3.130.0080.05512.65
5.3.120.0130.05112.66
5.3.110.0070.06312.66
5.3.100.0130.03512.12
5.3.90.0050.03912.10
5.3.80.0080.03612.09
5.3.70.0070.03712.09
5.3.60.0100.04312.08
5.3.50.0090.04512.02
5.3.40.0090.03712.02
5.3.30.0090.03411.98
5.3.20.0090.04711.76
5.3.10.0100.03411.73
5.3.00.0090.04411.72
5.2.170.0080.0299.22
5.2.160.0040.0329.22
5.2.150.0070.0319.22
5.2.140.0050.0439.21
5.2.130.0080.0549.17
5.2.120.0090.0729.18
5.2.110.0090.0549.18
5.2.100.0060.0349.18
5.2.90.0240.0529.17
5.2.80.0150.0969.16
5.2.70.0120.0359.16
5.2.60.0060.0389.13
5.2.50.0190.0999.11
5.2.40.0050.0329.08
5.2.30.0030.0349.05
5.2.20.0070.0329.03
5.2.10.0060.0368.95
5.2.00.0080.0898.82
5.1.60.0070.0248.09
5.1.50.0070.0268.09
5.1.40.0080.0478.09
5.1.30.0070.0278.42
5.1.20.0240.0948.45
5.1.10.0110.0348.18
5.1.00.0140.0648.18
5.0.50.0090.0376.66
5.0.40.0090.0216.53
5.0.30.0070.0316.33
5.0.20.0040.0256.30
5.0.10.0040.0236.28
5.0.00.0020.0336.27
4.4.90.0030.0174.77
4.4.80.0050.0174.75
4.4.70.0030.0174.76
4.4.60.0040.0174.76
4.4.50.0020.0284.77
4.4.40.0040.0354.71
4.4.30.0040.0144.76
4.4.20.0070.0144.84
4.4.10.0040.0194.85
4.4.00.0000.0284.76
4.3.110.0030.0194.67
4.3.100.0030.0194.66
4.3.90.0030.0164.64
4.3.80.0060.0264.58
4.3.70.0010.0194.63
4.3.60.0020.0154.63
4.3.50.0050.0144.62
4.3.40.0040.0234.54
4.3.30.0040.0173.29
4.3.20.0110.0393.27
4.3.10.0020.0183.24
4.3.00.0030.02013.91

preferences:
35.13 ms | 400 KiB | 5 Q