3v4l.org

run code in 300+ PHP versions simultaneously
<?php function Price($c,$pid){ //return '0.00'; $p=array(); $mintcard=array(); if(count($c)===0) return false; foreach($c as $comp => $competitor){ $p[] = $competitor['price']; if($comp=='mtgmintcard'){ $mintcard['stock'] = (int)$competitor['stock']; $mintcard['price'] = (float)$competitor['price']; } } if(count($mintcard)===0) return false; $min = _MIN($p); $avg = _AVG($p); if($mintcard['stock']===-1){ $foil=1; $pid = 40230; if($pid!==false){ $mintcard['stock'] = 24; }else{ $mintcard['stock'] = 0; } }else{ $foil=0; } if($mintcard['stock']>=1){ switch(true){ case $min <= 0.10: $price = (30 > 35 ? 0.05 : $min); break; case $min > 0.10 && $min < 0.16: $price = bcmul($min,1,2); break; case $min >= 0.16 && $min <= 0.99: $price = bcmul($avg,0.95,2); break; case $min >= 1.00 && $min <= 1.99: $price = bcdiv(bcmul((bcadd($avg,$mintcard['price'],2)),0.95,2),2,2) ; break; // + mtg price case $min >= 2.00: $price = bcmul($min,0.99,2); break; default: $price = 0; break; } }elseif($mintcard['stock']===0){ //switch(true){ /*case $min <= 0.10: $price = (_SQL_FETCHSTOCK($pid) > 35 ? 0.05 : $min); break; case $min >= 0.10 && $min < 0.16: $price = bcmul($min,0.99,2); break; case $min >= 0.16 && $min <= 0.99: $price = bcmul($avg,0.95,2); break; case $min >= 1.00 : $price = bcdiv(bcmul((bcadd($avg,$mintcard['price'],2)),0.95,2),2,2); break; // + mtg price default: $price = false; break;*/ //} $price = $avg; } if($foil===1){ $foilPrice = FoilPrice((float)$price); echo ('pricing '.$pid.' Foil identified: increased price from '.(float)$price.' to '.$foilPrice); $price = $foilPrice; } return (float)$price; } function FoilPrice($price){ switch(true){ case $price <= 1.00: $fprice = bcmul($price,3,2); break; case $price > 1.00 && $price <= 10.00: $fprice = bcmul($price,2.5,2); break; case $price > 10.00: $fprice = bcmul($price,2,2); break; } return (float)$fprice; } function _AVG($args){ /*$count = func_num_args(); $args = func_get_args();*/ $count = count($args); $sum = array_sum($args); return (float)bcdiv($sum,$count,2); } function _MIN($args){ return (float)min($args); } $arr = array( "mtgmintcard"=> array( "date_id"=>(int)67, "price"=>(float)0.2, "stock"=>(int)-1 ), "manaleak"=> array( "date_id"=>(int)67, "price"=>(float)0.35, "stock"=>(int)-1 ), "magicmadhouse"=> array( "date_id"=>(int)67, "price"=>(float)0.49, "stock"=>(int)-1 ), ); echo Price($arr,57521);

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.0130.00318.41
8.3.50.0100.01021.14
8.3.40.0110.00419.02
8.3.30.0030.01020.17
8.3.20.0040.00418.78
8.3.10.0000.00821.27
8.3.00.0050.00323.71
8.2.180.0120.00316.75
8.2.170.0120.00622.96
8.2.160.0030.01320.43
8.2.150.0060.00324.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00419.75
8.2.110.0050.00521.18
8.2.100.0000.01217.91
8.2.90.0040.00419.27
8.2.80.0030.00517.97
8.2.70.0080.00017.63
8.2.60.0060.00318.03
8.2.50.0030.00618.10
8.2.40.0030.00518.28
8.2.30.0000.00819.54
8.2.20.0000.00817.82
8.2.10.0000.00717.92
8.2.00.0060.00317.74
8.1.280.0070.00725.92
8.1.270.0070.00023.99
8.1.260.0000.00726.35
8.1.250.0050.00228.09
8.1.240.0040.00419.27
8.1.230.0120.00017.82
8.1.220.0040.00417.80
8.1.210.0080.00018.77
8.1.200.0070.00317.48
8.1.190.0000.00817.48
8.1.180.0000.00818.10
8.1.170.0080.00018.62
8.1.160.0040.00419.02
8.1.150.0000.00818.74
8.1.140.0050.00317.51
8.1.130.0000.00717.89
8.1.120.0070.00017.48
8.1.110.0000.00817.40
8.1.100.0000.00817.43
8.1.90.0030.00517.47
8.1.80.0070.00017.51
8.1.70.0000.00717.48
8.1.60.0060.00317.55
8.1.50.0030.00517.48
8.1.40.0030.00517.41
8.1.30.0000.00817.62
8.1.20.0040.00417.68
8.1.10.0050.00317.64
8.1.00.0000.00717.54
8.0.300.0040.00418.77
8.0.290.0090.00016.75
8.0.280.0000.00718.37
8.0.270.0000.00717.16
8.0.260.0050.00316.93
8.0.250.0070.00017.02
8.0.240.0030.00716.96
8.0.230.0030.00316.97
8.0.220.0000.00716.91
8.0.210.0000.00717.01
8.0.200.0000.00717.11
8.0.190.0030.00617.09
8.0.180.0000.00816.91
8.0.170.0000.00816.93
8.0.160.0000.00717.02
8.0.150.0000.00816.94
8.0.140.0000.01016.90
8.0.130.0060.00013.48
8.0.120.0030.00516.96
8.0.110.0000.00816.99
8.0.100.0000.00716.95
8.0.90.0000.00716.90
8.0.80.0110.00416.98
8.0.70.0050.00316.82
8.0.60.0000.00716.99
8.0.50.0030.00516.87
8.0.30.0060.01517.20
8.0.20.0070.01217.40
8.0.10.0050.00217.02
8.0.00.0120.00716.90
7.4.330.0030.00316.72
7.4.320.0030.00316.64
7.4.300.0040.00416.47
7.4.290.0050.00516.55
7.4.280.0000.00716.54
7.4.270.0000.00716.57
7.4.260.0050.00013.30
7.4.250.0070.00016.52
7.4.240.0000.00716.63
7.4.230.0000.00816.30
7.4.220.0130.01016.65
7.4.210.0060.00816.60
7.4.200.0070.00016.47
7.4.190.0040.00416.82
7.4.160.0130.00316.41
7.4.150.0120.00617.40
7.4.140.0070.01117.86
7.4.130.0030.01316.50
7.4.120.0120.00716.55
7.4.110.0120.01216.62
7.4.100.0090.01316.40
7.4.90.0120.00916.45
7.4.80.0030.01419.39
7.4.70.0060.01216.70
7.4.60.0140.00416.45
7.4.50.0030.00516.36
7.4.40.0030.00922.77
7.4.30.0090.00916.59
7.4.00.0040.01214.83
7.3.330.0060.00013.34
7.3.320.0060.00013.55
7.3.310.0000.00716.46
7.3.300.0030.00316.49
7.3.290.0030.01216.40
7.3.280.0080.01016.42
7.3.270.0120.00617.40
7.3.260.0150.00818.24
7.3.250.0090.01116.71
7.3.240.0120.00416.43
7.3.230.0090.00916.48
7.3.210.0110.00716.45
7.3.200.0100.01319.39
7.3.190.0070.01416.33
7.3.180.0090.00616.43
7.3.170.0060.01616.61
7.3.160.0100.00616.55
7.3.120.0030.01415.11
7.2.330.0100.01016.77
7.2.320.0090.01216.87
7.2.310.0110.00616.61
7.2.300.0070.01016.68
7.2.290.0100.00716.81
7.2.00.0040.01219.55
7.1.100.0030.01018.11
7.1.70.0060.00616.80
7.1.60.0030.02319.17
7.1.50.0090.01216.70
7.1.00.0000.07722.40
7.0.200.0030.00616.64
7.0.140.0070.07021.99
7.0.100.0030.08320.07
7.0.90.0100.08319.92
7.0.80.0330.06319.99
7.0.70.0130.04319.99
7.0.60.0230.07019.98
7.0.50.0130.07320.30
7.0.40.0070.05720.11
7.0.30.0100.05020.15
7.0.20.0100.08320.00
7.0.10.0030.05020.18
7.0.00.0030.05020.10
5.6.280.0000.07721.13
5.6.250.0070.08720.77
5.6.240.0100.06720.63
5.6.230.0130.07020.77
5.6.220.0100.05720.64
5.6.210.0130.04020.49
5.6.200.0070.05021.08
5.6.190.0130.06321.03
5.6.180.0030.08320.96
5.6.170.0170.07020.97
5.6.160.0100.05021.16
5.6.150.0170.07021.08
5.6.140.0130.08021.06
5.6.130.0000.05021.13
5.6.120.0070.06021.00
5.6.110.0030.05021.12
5.6.100.0070.07021.03
5.6.90.0070.04321.17
5.6.80.0030.05020.46
5.6.70.0000.04320.50
5.6.60.0070.07320.43
5.6.50.0130.05720.36
5.6.40.0000.08720.41
5.6.30.0070.04320.42
5.6.20.0130.07020.54
5.6.10.0070.05020.40
5.6.00.0000.04320.54
5.5.380.0100.06020.39
5.5.370.0030.08720.37
5.5.360.0070.09020.40
5.5.350.0070.07720.48
5.5.340.0030.08020.94
5.5.330.0070.07320.82
5.5.320.0030.06020.82
5.5.310.0100.08320.86
5.5.300.0030.08720.80
5.5.290.0100.05720.65
5.5.280.0070.06020.93
5.5.270.0030.05320.80
5.5.260.0070.07720.94
5.5.250.0030.08320.62
5.5.240.0100.06320.01
5.5.230.0100.08020.20
5.5.220.0030.08320.04
5.5.210.0030.08020.14
5.5.200.0170.06720.18
5.5.190.0000.09020.13
5.5.180.0170.02720.29
5.5.160.0000.04020.30
5.5.150.0030.05020.16
5.5.140.0030.07720.26
5.5.130.0130.07020.00
5.5.120.0100.04320.20
5.5.110.0070.07020.25
5.5.100.0070.07019.97
5.5.90.0030.08020.15
5.5.80.0070.04020.17
5.5.70.0100.07020.09
5.5.60.0070.03720.13
5.5.50.0130.02719.95
5.5.40.0030.04720.17
5.5.30.0170.05320.02
5.5.20.0100.04320.08
5.5.10.0130.05020.08
5.5.00.0030.07020.04
5.4.450.0130.07319.52
5.4.440.0070.08319.51
5.4.430.0100.07019.36
5.4.420.0070.07719.26
5.4.410.0070.04019.11
5.4.400.0030.05018.91
5.4.390.0130.03719.16
5.4.380.0070.07019.06
5.4.370.0000.08018.85
5.4.360.0070.07719.13
5.4.350.0070.07019.14
5.4.340.0070.07019.14
5.4.320.0070.07719.03
5.4.310.0070.07019.12
5.4.300.0070.07719.13
5.4.290.0130.07319.05
5.4.280.0070.03719.12
5.4.270.0030.08019.02
5.4.260.0100.07719.02
5.4.250.0100.03718.85
5.4.240.0030.07319.04
5.4.230.0000.07719.23
5.4.220.0000.04319.12
5.4.210.0070.07719.17
5.4.200.0070.04019.19
5.4.190.0070.04018.89
5.4.180.0070.04718.84
5.4.170.0070.05019.03
5.4.160.0070.07319.12
5.4.150.0070.04019.10
5.4.140.0070.03716.39
5.4.130.0030.07716.39
5.4.120.0000.04016.49
5.4.110.0000.06716.53
5.4.100.0030.07716.34
5.4.90.0130.05016.44
5.4.80.0100.04716.53
5.4.70.0030.03716.31
5.4.60.0030.07716.32
5.4.50.0130.03016.47
5.4.40.0030.07016.45
5.4.30.0070.03716.34
5.4.20.0170.04016.31
5.4.10.0030.07716.34
5.4.00.0100.07715.88
5.3.290.0070.04314.77
5.3.280.0030.08014.70
5.3.270.0100.05714.77
5.3.260.0130.06014.62
5.3.250.0030.07714.66
5.3.240.0100.07014.64
5.3.230.0170.06014.70
5.3.220.0000.04014.61
5.3.210.0130.05314.71
5.3.200.0170.05714.72
5.3.190.0100.06014.73
5.3.180.0130.07314.56
5.3.170.0030.04314.56
5.3.160.0100.05314.57
5.3.150.0100.07714.72
5.3.140.0070.06314.65
5.3.130.0030.08014.64
5.3.120.0100.03714.59
5.3.110.0070.06714.61
5.3.100.0030.07014.09
5.3.90.0070.04014.02
5.3.80.0070.08014.19
5.3.70.0070.05014.03
5.3.60.0070.05714.12
5.3.50.0000.05314.09
5.3.40.0070.04013.96
5.3.30.0000.04714.04
5.3.20.0030.04013.83
5.3.10.0100.04013.80
5.3.00.0070.05313.76
5.2.170.0070.03012.31
5.2.160.0030.05012.31
5.2.150.0070.05312.31
5.2.140.0070.02712.31
5.2.130.0030.06312.31
5.2.120.0030.04312.31
5.2.110.0100.05012.31
5.2.100.0100.05712.31
5.2.90.0100.05712.31
5.2.80.0100.05312.31
5.2.70.0000.06012.31
5.2.60.0000.03712.31
5.2.50.0130.04012.31
5.2.40.0070.05012.31
5.2.30.0000.04312.31
5.2.20.0100.05712.31
5.2.10.0100.03012.31
5.2.00.0030.03712.31
5.1.60.0070.05012.31
5.1.50.0030.05712.31
5.1.40.0100.04312.31
5.1.30.0000.03312.31
5.1.20.0070.05312.31
5.1.10.0070.04312.31
5.1.00.0070.04712.31
5.0.50.0070.04312.31
5.0.40.0030.03012.31
5.0.30.0070.04012.31
5.0.20.0030.04012.31
5.0.10.0070.04012.31
5.0.00.0100.03312.31
4.4.90.0030.01712.31
4.4.80.0000.01712.31
4.4.70.0030.03312.31
4.4.60.0030.03312.31
4.4.50.0030.03012.31
4.4.40.0030.05012.31
4.4.30.0030.03712.31
4.4.20.0030.03312.31
4.4.10.0030.02012.31
4.4.00.0030.06012.31
4.3.110.0030.03312.31
4.3.100.0030.03712.31
4.3.90.0030.01712.31
4.3.80.0030.04712.31
4.3.70.0070.03312.31
4.3.60.0000.02012.31
4.3.50.0000.02312.31
4.3.40.0000.03012.31
4.3.30.0000.01712.31
4.3.20.0000.03312.31
4.3.10.0070.01312.31
4.3.00.0000.02012.31

preferences:
43.7 ms | 401 KiB | 5 Q