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($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 $fprice; } function _AVG($args){ /*$count = func_num_args(); $args = func_get_args();*/ $count = count($args); $sum = array_sum($args); return bcdiv($sum,$count,2); } function _MIN($args){ return 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.68
8.3.50.0140.00721.15
8.3.40.0070.00718.67
8.3.30.0110.00320.33
8.3.20.0030.00618.90
8.3.10.0040.00421.27
8.3.00.0080.00023.45
8.2.180.0130.00616.50
8.2.170.0110.00722.96
8.2.160.0070.01020.57
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0000.00826.16
8.2.120.0080.00019.95
8.2.110.0090.00019.20
8.2.100.0080.00417.85
8.2.90.0000.00819.30
8.2.80.0000.00817.97
8.2.70.0050.00317.63
8.2.60.0040.00418.01
8.2.50.0040.00418.10
8.2.40.0000.00819.95
8.2.30.0000.00819.38
8.2.20.0040.00417.84
8.2.10.0030.00517.92
8.2.00.0080.00017.86
8.1.280.0080.00825.92
8.1.270.0040.00423.99
8.1.260.0070.00026.35
8.1.250.0080.00028.09
8.1.240.0100.00021.37
8.1.230.0030.00917.82
8.1.220.0090.00017.91
8.1.210.0040.00418.77
8.1.200.0060.00317.61
8.1.190.0080.00017.35
8.1.180.0080.00018.10
8.1.170.0080.00318.49
8.1.160.0040.00418.94
8.1.150.0040.00418.70
8.1.140.0020.00517.51
8.1.130.0000.00717.85
8.1.120.0070.00017.48
8.1.110.0040.00417.41
8.1.100.0000.00717.41
8.1.90.0000.00817.51
8.1.80.0050.00217.53
8.1.70.0040.00417.49
8.1.60.0030.00617.52
8.1.50.0000.00717.58
8.1.40.0000.00717.45
8.1.30.0040.00417.66
8.1.20.0000.00817.60
8.1.10.0030.00517.67
8.1.00.0060.00317.46
8.0.300.0000.00818.77
8.0.290.0080.00016.75
8.0.280.0030.00318.50
8.0.270.0000.00717.21
8.0.260.0000.00816.95
8.0.250.0000.00717.05
8.0.240.0100.00017.07
8.0.230.0030.00316.98
8.0.220.0000.00816.97
8.0.210.0070.00017.00
8.0.200.0030.00316.90
8.0.190.0040.00416.98
8.0.180.0040.00416.92
8.0.170.0080.00016.89
8.0.160.0040.00417.04
8.0.150.0000.00716.91
8.0.140.0100.00016.95
8.0.130.0000.00713.41
8.0.120.0040.00416.90
8.0.110.0070.00017.00
8.0.100.0050.00317.01
8.0.90.0070.00016.89
8.0.80.0060.01116.95
8.0.70.0000.00716.91
8.0.60.0080.00017.05
8.0.50.0040.00416.96
8.0.30.0110.01117.00
8.0.20.0120.00717.40
8.0.10.0000.00717.16
8.0.00.0110.00816.90
7.4.330.0000.00516.83
7.4.320.0030.00316.68
7.4.300.0050.00216.70
7.4.290.0000.00816.52
7.4.280.0030.00316.64
7.4.270.0030.00316.45
7.4.260.0030.00313.23
7.4.250.0040.00416.53
7.4.240.0000.00716.70
7.4.230.0040.00416.56
7.4.220.0120.01016.61
7.4.210.0080.01316.63
7.4.200.0070.00016.73
7.4.190.0030.00516.52
7.4.160.0120.00616.69
7.4.150.0170.00617.40
7.4.140.0120.00517.86
7.4.130.0060.01116.50
7.4.120.0070.01416.49
7.4.110.0100.01316.64
7.4.100.0100.00716.66
7.4.90.0090.00916.61
7.4.80.0030.01319.39
7.4.70.0040.01316.45
7.4.60.0160.00716.46
7.4.50.0030.00616.63
7.4.40.0030.01022.77
7.4.30.0070.01016.57
7.4.10.0060.01314.97
7.4.00.0110.00615.05
7.3.330.0000.00513.47
7.3.320.0050.00013.47
7.3.310.0030.00516.55
7.3.300.0000.00716.39
7.3.290.0070.00716.46
7.3.280.0090.00916.48
7.3.270.0100.00717.40
7.3.260.0130.00718.24
7.3.250.0090.01216.56
7.3.240.0060.01216.49
7.3.230.0110.00616.46
7.3.210.0130.00316.49
7.3.200.0120.00919.39
7.3.190.0080.00816.74
7.3.180.0060.01016.36
7.3.170.0040.01316.52
7.3.160.0060.01016.49
7.3.130.0080.00815.18
7.3.120.0060.00914.88
7.3.110.0130.00714.88
7.3.100.0000.01414.80
7.3.90.0060.00914.82
7.3.80.0040.00814.78
7.3.70.0080.01114.98
7.3.60.0000.01114.76
7.3.50.0030.01014.84
7.3.40.0000.01314.90
7.3.30.0080.00414.67
7.3.20.0110.00316.74
7.3.10.0080.00516.76
7.3.00.0060.00916.65
7.2.330.0100.00716.79
7.2.320.0040.01416.72
7.2.310.0100.01016.83
7.2.300.0070.00916.64
7.2.290.0060.01016.96
7.2.260.0070.01415.19
7.2.250.0040.01515.07
7.2.240.0070.01114.97
7.2.230.0030.01315.41
7.2.220.0000.01815.20
7.2.210.0150.00315.22
7.2.200.0100.01014.91
7.2.190.0070.00715.16
7.2.180.0030.01015.13
7.2.170.0120.00315.20
7.2.160.0090.00614.99
7.2.150.0060.00316.82
7.2.140.0120.00316.91
7.2.130.0050.00916.99
7.2.120.0070.01017.04
7.2.110.0030.01116.90
7.2.100.0050.01216.85
7.2.90.0080.00517.14
7.2.80.0050.00517.02
7.2.70.0050.01016.94
7.2.60.0090.00716.93
7.2.50.0050.00916.90
7.2.40.0050.00917.05
7.2.30.0070.00817.04
7.2.20.0040.00916.96
7.2.10.0020.01516.97
7.2.00.0090.00517.77
7.1.330.0110.00415.88
7.1.320.0000.01115.73
7.1.310.0090.00615.53
7.1.300.0090.00315.84
7.1.290.0090.00915.89
7.1.280.0120.00315.72
7.1.270.0100.00315.68
7.1.260.0070.00415.77
7.1.250.0040.01015.88
7.1.240.0000.01215.64
7.1.230.0030.01015.76
7.1.220.0070.00715.78
7.1.210.0030.01015.85
7.1.200.0060.00315.71
7.1.190.0030.01315.96
7.1.180.0040.01515.94
7.1.170.0100.00315.93
7.1.160.0070.00715.93
7.1.150.0110.00315.68
7.1.140.0000.01115.97
7.1.130.0090.00615.75
7.1.120.0060.00615.94
7.1.110.0060.00615.81
7.1.100.0080.00916.91
7.1.90.0040.01215.92
7.1.80.0050.00515.87
7.1.70.0050.00416.45
7.1.60.0080.01217.49
7.1.50.0060.01416.28
7.1.40.0030.01315.82
7.1.30.0040.01115.96
7.1.20.0040.00715.58
7.1.10.0040.01215.77
7.1.00.0030.02419.20
7.0.330.0040.01415.64
7.0.320.0060.00315.39
7.0.310.0090.00315.32
7.0.300.0070.01015.33
7.0.290.0120.00315.39
7.0.280.0070.01115.32
7.0.270.0130.00315.43
7.0.260.0100.01015.55
7.0.250.0060.00915.48
7.0.240.0050.00315.52
7.0.230.0060.00615.23
7.0.220.0140.00015.49
7.0.210.0070.00715.54
7.0.200.0030.00716.02
7.0.190.0110.00615.44
7.0.180.0000.01915.38
7.0.170.0110.00815.32
7.0.160.0060.00615.28
7.0.150.0000.01515.44
7.0.140.0070.04018.67
7.0.130.0070.00415.55
7.0.120.0110.00415.34
7.0.110.0040.00815.28
7.0.100.0030.04717.77
7.0.90.0100.04017.83
7.0.80.0050.02617.79
7.0.70.0090.04117.77
7.0.60.0100.04217.76
7.0.50.0070.04318.07
7.0.40.0080.04516.72
7.0.30.0070.04916.78
7.0.20.0070.04216.81
7.0.10.0030.04416.73
7.0.00.0110.03316.83
5.6.400.0070.00814.80
5.6.390.0030.01314.52
5.6.380.0090.00314.79
5.6.370.0090.00614.62
5.6.360.0070.00714.27
5.6.350.0060.01014.93
5.6.340.0070.01014.48
5.6.330.0000.01114.51
5.6.320.0060.01014.14
5.6.310.0040.01114.46
5.6.300.0000.01314.32
5.6.290.0130.00014.70
5.6.280.0050.04017.86
5.6.270.0030.01414.76
5.6.260.0100.00014.39
5.6.250.0050.04817.52
5.6.240.0050.05017.63
5.6.230.0070.04917.59
5.6.220.0100.04217.61
5.6.210.0050.04717.41
5.6.200.0070.04017.73
5.6.190.0100.04217.68
5.6.180.0070.04417.79
5.6.170.0070.04617.85
5.6.160.0130.03717.92
5.6.150.0030.04917.79
5.6.140.0090.04517.72
5.6.130.0070.04417.59
5.6.120.0070.04617.65
5.6.110.0050.03317.72
5.6.100.0110.03917.74
5.6.90.0050.04117.62
5.6.80.0030.04417.37
5.6.70.0050.04517.56
5.6.60.0090.03017.34
5.6.50.0080.03817.22
5.6.40.0050.04517.40
5.6.30.0100.04017.41
5.6.20.0100.04017.35
5.6.10.0070.04517.34
5.6.00.0070.02317.51
5.5.380.0090.04217.35
5.5.370.0020.05017.39
5.5.360.0110.04017.62
5.5.350.0060.04317.52
5.5.340.0020.03417.66
5.5.330.0050.04117.60
5.5.320.0090.04417.66
5.5.310.0060.04617.87
5.5.300.0150.03817.77
5.5.290.0130.03817.74
5.5.280.0060.04117.75
5.5.270.0070.04417.54
5.5.260.0100.04117.75
5.5.250.0050.04517.31
5.5.240.0100.04017.18
5.5.230.0080.04317.12
5.5.220.0120.04017.30
5.5.210.0070.03717.21
5.5.200.0080.04017.24
5.5.190.0080.03717.23
5.5.180.0080.04317.14
5.5.170.0090.00514.54
5.5.160.0050.03717.38
5.5.150.0070.04017.28
5.5.140.0100.04017.29
5.5.130.0030.03417.38
5.5.120.0120.03817.31
5.5.110.0120.03817.15
5.5.100.0020.04317.25
5.5.90.0070.04317.24
5.5.80.0050.04517.28
5.5.70.0110.03417.37
5.5.60.0100.03417.31
5.5.50.0030.02817.16
5.5.40.0090.03717.18
5.5.30.0050.04317.16
5.5.20.0030.04417.31
5.5.10.0080.03917.22
5.5.00.0080.04517.27
5.4.450.0060.04515.40
5.4.440.0070.04215.13
5.4.430.0100.02415.37
5.4.420.0020.04415.32
5.4.410.0080.03515.35
5.4.400.0050.04215.10
5.4.390.0020.04815.18
5.4.380.0030.04415.29
5.4.370.0040.04415.06
5.4.360.0040.04115.02
5.4.350.0100.03715.12
5.4.340.0100.03515.13
5.4.330.0000.01011.11
5.4.320.0040.04415.14
5.4.310.0080.03115.17
5.4.300.0030.04615.23
5.4.290.0080.03715.19
5.4.280.0030.03415.02
5.4.270.0050.03715.13
5.4.260.0040.04015.12
5.4.250.0050.03014.97
5.4.240.0050.04215.12
5.4.230.0030.04414.98
5.4.220.0080.03915.09
5.4.210.0120.03815.07
5.4.200.0110.03815.21
5.4.190.0040.02915.13
5.4.180.0070.03315.08
5.4.170.0120.03715.11
5.4.160.0050.02815.23
5.4.150.0050.04215.12
5.4.140.0030.03813.80
5.4.130.0020.04213.91
5.4.120.0100.03413.84
5.4.110.0040.04013.82
5.4.100.0070.03814.00
5.4.90.0080.03713.75
5.4.80.0030.03713.74
5.4.70.0090.03313.93
5.4.60.0080.03813.84
5.4.50.0050.03513.81
5.4.40.0020.04113.86
5.4.30.0040.04213.68
5.4.20.0050.03113.67
5.4.10.0020.04613.68
5.4.00.0070.03513.48
5.3.290.0030.04612.70
5.3.280.0070.04312.60
5.3.270.0100.03112.58
5.3.260.0030.04112.75
5.3.250.0050.04012.74
5.3.240.0090.03912.63
5.3.230.0050.04112.56
5.3.220.0050.04212.61
5.3.210.0070.03712.65
5.3.200.0070.04012.51
5.3.190.0120.03212.49
5.3.180.0080.03712.67
5.3.170.0050.03712.74
5.3.160.0070.04012.61
5.3.150.0050.04112.75
5.3.140.0020.04112.73
5.3.130.0050.04012.58
5.3.120.0030.04512.67
5.3.110.0050.04212.72
5.3.100.0050.03812.39
5.3.90.0020.04212.35
5.3.80.0080.03612.31
5.3.70.0030.04312.40
5.3.60.0050.03812.41
5.3.50.0050.02212.32
5.3.40.0050.04112.36
5.3.30.0030.03712.31
5.3.20.0050.03112.15
5.3.10.0050.04011.96
5.3.00.0050.02512.12
5.2.170.0030.03711.28
5.2.160.0030.06011.32
5.2.150.0070.06311.08
5.2.140.0130.05011.10
5.2.130.0000.06711.28
5.2.120.0030.06311.28
5.2.110.0030.06311.25
5.2.100.0070.06011.00
5.2.90.0070.05711.20
5.2.80.0000.04311.25
5.2.70.0030.06311.04
5.2.60.0100.05711.10
5.2.50.0130.03311.20
5.2.40.0000.06711.17
5.2.30.0000.06710.92
5.2.20.0100.06011.01
5.2.10.0070.05710.81
5.2.00.0000.05710.88
5.1.60.0030.05010.07
5.1.50.0070.0509.92
5.1.40.0000.03310.08
5.1.30.0030.03010.51
5.1.20.0030.05710.41
5.1.10.0100.05010.10
5.1.00.0070.0539.95
5.0.50.0030.0278.66
5.0.40.0030.0438.56
5.0.30.0130.0608.11
5.0.20.0070.0378.24
5.0.10.0030.0478.24
5.0.00.0030.0608.30
4.4.90.0030.0378.05
4.4.80.0070.0338.05
4.4.70.0000.0338.05
4.4.60.0030.0338.05
4.4.50.0030.0378.05
4.4.40.0030.0578.05
4.4.30.0000.0378.05
4.4.20.0030.0378.05
4.4.10.0030.0208.05
4.4.00.0000.0538.05
4.3.110.0030.0338.05
4.3.100.0030.0338.05
4.3.90.0100.0138.05
4.3.80.0030.0508.05
4.3.70.0000.0338.05
4.3.60.0000.0338.05
4.3.50.0070.0308.05
4.3.40.0030.0508.05
4.3.30.0000.0378.05
4.3.20.0030.0238.05
4.3.10.0100.0278.05
4.3.00.0000.0378.05

preferences:
46.53 ms | 401 KiB | 5 Q