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.00618.55
8.3.50.0120.00821.27
8.3.40.0070.00718.87
8.3.30.0100.00320.07
8.3.20.0060.00318.63
8.3.10.0060.00320.96
8.3.00.0000.00823.48
8.2.180.0090.00916.63
8.2.170.0110.01122.96
8.2.160.0070.00720.38
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0040.00419.76
8.2.110.0160.00720.89
8.2.100.0030.00917.78
8.2.90.0040.00419.01
8.2.80.0040.00417.97
8.2.70.0040.00417.50
8.2.60.0030.00517.91
8.2.50.0030.00518.10
8.2.40.0090.00018.09
8.2.30.0040.00419.41
8.2.20.0000.00817.73
8.2.10.0030.00617.78
8.2.00.0060.00317.79
8.1.280.0140.00025.92
8.1.270.0000.00823.99
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0060.00321.29
8.1.230.0040.00718.95
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0030.00717.48
8.1.190.0000.00817.23
8.1.180.0040.00418.10
8.1.170.0060.00318.84
8.1.160.0040.00418.82
8.1.150.0030.00518.56
8.1.140.0050.00217.38
8.1.130.0080.00017.73
8.1.120.0040.00417.39
8.1.110.0030.00617.29
8.1.100.0040.00417.39
8.1.90.0040.00417.36
8.1.80.0000.00717.26
8.1.70.0070.00017.37
8.1.60.0060.00317.47
8.1.50.0040.00417.40
8.1.40.0040.00417.54
8.1.30.0000.00717.47
8.1.20.0000.00817.54
8.1.10.0000.00817.52
8.1.00.0050.00317.34
8.0.300.0030.00618.84
8.0.290.0040.00416.88
8.0.280.0000.00718.57
8.0.270.0030.00317.25
8.0.260.0030.00316.80
8.0.250.0080.00017.08
8.0.240.0090.00017.00
8.0.230.0000.00716.91
8.0.220.0040.00416.98
8.0.210.0070.00016.95
8.0.200.0030.00316.98
8.0.190.0040.00416.95
8.0.180.0000.00816.87
8.0.170.0030.00616.92
8.0.160.0000.00716.79
8.0.150.0000.00816.91
8.0.140.0100.00016.89
8.0.130.0030.00313.34
8.0.120.0030.00516.93
8.0.110.0030.00316.84
8.0.100.0040.00416.99
8.0.90.0040.00416.89
8.0.80.0090.00716.91
8.0.70.0040.00416.87
8.0.60.0000.00816.96
8.0.50.0070.00016.86
8.0.30.0140.01117.13
8.0.20.0110.00817.40
8.0.10.0070.00017.01
8.0.00.0080.01416.83
7.4.330.0000.00616.66
7.4.320.0030.00316.54
7.4.300.0060.00016.50
7.4.290.0060.00316.55
7.4.280.0040.00416.44
7.4.270.0030.00316.49
7.4.260.0030.00313.27
7.4.250.0030.00616.59
7.4.240.0000.00716.53
7.4.230.0000.00816.34
7.4.220.0090.00916.59
7.4.210.0080.00716.68
7.4.200.0040.00416.70
7.4.190.0030.00316.70
7.4.160.0090.00616.43
7.4.150.0060.01117.40
7.4.140.0090.00917.86
7.4.130.0070.01016.50
7.4.120.0100.01016.41
7.4.110.0100.01316.57
7.4.100.0160.00616.57
7.4.90.0090.00916.52
7.4.80.0140.00319.39
7.4.70.0080.00816.71
7.4.60.0060.01216.55
7.4.50.0040.00416.64
7.4.40.0070.00722.77
7.4.30.0030.01416.63
7.4.00.0120.00514.83
7.3.330.0050.00013.17
7.3.320.0050.00013.21
7.3.310.0000.00716.36
7.3.300.0000.00716.22
7.3.290.0130.00316.33
7.3.280.0100.00816.30
7.3.270.0120.00617.40
7.3.260.0140.01118.24
7.3.250.0140.00416.35
7.3.240.0100.01016.52
7.3.230.0140.00716.42
7.3.210.0060.01216.42
7.3.200.0160.00319.39
7.3.190.0130.00916.36
7.3.180.0130.00316.42
7.3.170.0080.00816.43
7.3.160.0090.00616.57
7.3.120.0070.01115.06
7.3.110.0030.01014.76
7.3.100.0030.00715.03
7.3.90.0040.00814.98
7.3.80.0030.01014.91
7.3.70.0070.00314.86
7.3.60.0090.00314.67
7.3.50.0000.01614.86
7.3.40.0000.01014.90
7.3.30.0030.01114.82
7.3.20.0080.00816.41
7.3.10.0100.00516.18
7.3.00.0110.00316.37
7.2.330.0090.00816.59
7.2.320.0110.00816.68
7.2.310.0070.01016.57
7.2.300.0070.01016.68
7.2.290.0130.00916.52
7.2.250.0070.01015.05
7.2.240.0060.01215.15
7.2.230.0030.01014.84
7.2.220.0040.01114.77
7.2.210.0070.00715.15
7.2.200.0030.01314.74
7.2.190.0000.01514.89
7.2.180.0060.00914.88
7.2.170.0000.01515.05
7.2.130.0110.00816.35
7.2.120.0090.01016.26
7.2.110.0080.01016.19
7.2.100.0090.00816.30
7.2.90.0120.00516.46
7.2.80.0120.00616.38
7.2.70.0170.00016.35
7.2.60.0090.00416.38
7.2.50.0140.00516.40
7.2.40.0120.00316.50
7.2.30.0080.00816.17
7.2.20.0140.00516.42
7.2.10.0110.00616.26
7.2.00.0150.00617.54
7.1.330.0060.01015.83
7.1.320.0030.00615.78
7.1.310.0000.01515.67
7.1.300.0090.00615.73
7.1.290.0040.00415.52
7.1.280.0030.01015.67
7.1.270.0030.01015.68
7.1.260.0110.00415.75
7.1.250.0100.00715.13
7.1.240.0070.00415.33
7.1.230.0100.00315.48
7.1.220.0100.00615.47
7.1.210.0000.00915.35
7.1.200.0060.00815.32
7.1.190.0090.00615.52
7.1.180.0100.00615.58
7.1.170.0080.00815.41
7.1.160.0150.00015.30
7.1.150.0090.00615.41
7.1.140.0100.00315.48
7.1.130.0100.00315.64
7.1.120.0120.00315.29
7.1.110.0090.00615.77
7.1.100.0110.00416.62
7.1.90.0090.00615.42
7.1.80.0140.00315.62
7.1.70.0080.00616.22
7.1.60.0060.01117.33
7.1.50.0120.01016.04
7.1.40.0090.00615.66
7.1.30.0130.00315.58
7.1.20.0070.00715.54
7.1.10.0030.01215.35
7.1.00.0080.03018.89
7.0.330.0030.00915.02
7.0.320.0080.00814.89
7.0.310.0030.01014.80
7.0.300.0040.01115.03
7.0.290.0080.00415.15
7.0.280.0100.00715.09
7.0.270.0080.00415.28
7.0.260.0140.00014.87
7.0.250.0070.00715.46
7.0.240.0060.00915.07
7.0.230.0110.00715.03
7.0.220.0090.00915.14
7.0.210.0070.01015.21
7.0.200.0090.00916.00
7.0.190.0180.00715.43
7.0.180.0210.01015.29
7.0.170.0160.00415.43
7.0.160.0120.00915.36
7.0.150.0060.00615.09
7.0.140.0110.03818.61
7.0.130.0170.00314.79
7.0.120.0100.00715.06
7.0.110.0120.04017.59
7.0.100.0170.03717.80
7.0.90.0120.03017.70
7.0.80.0200.03617.62
7.0.70.0130.04017.71
7.0.60.0150.03917.77
7.0.50.0100.04817.83
7.0.40.0140.04016.71
7.0.30.0110.04316.65
7.0.20.0120.03716.68
7.0.10.0120.04216.70
7.0.00.0030.04916.57
5.6.380.0090.00614.12
5.6.370.0000.01013.69
5.6.360.0130.00714.34
5.6.350.0140.00314.18
5.6.340.0190.00814.20
5.6.330.0080.01213.79
5.6.320.0120.01214.17
5.6.310.0100.01014.00
5.6.300.0170.00313.93
5.6.290.0110.00414.07
5.6.280.0130.00614.02
5.6.270.0000.01913.64
5.6.260.0040.01313.80
5.6.250.0130.03817.32
5.6.240.0100.04317.23
5.6.230.0060.03217.46
5.6.220.0040.05017.56
5.6.210.0120.04517.31
5.6.200.0100.04717.50
5.6.190.0120.04517.75
5.6.180.0080.04517.44
5.6.170.0030.04717.51
5.6.160.0080.04317.31
5.6.150.0050.04317.57
5.6.140.0080.04117.51
5.6.130.0040.05217.31
5.6.120.0050.04917.68
5.6.110.0040.04817.42
5.6.100.0060.03117.44
5.6.90.0090.04317.66
5.6.80.0060.04617.09
5.6.70.0080.04217.19
5.6.60.0110.04017.17
5.6.50.0080.03817.12
5.6.40.0090.04317.28
5.6.30.0050.04017.28
5.6.20.0100.03717.11
5.6.10.0140.02517.22
5.6.00.0070.04017.15
5.5.380.0090.04315.67
5.5.370.0080.04115.71
5.5.360.0050.03815.66
5.5.350.0140.03415.62
5.5.340.0120.03715.78
5.5.330.0060.04315.77
5.5.320.0050.03015.99
5.5.310.0110.04315.84
5.5.300.0030.02615.76
5.5.290.0030.04815.74
5.5.280.0060.02615.91
5.5.270.0020.04715.84
5.5.260.0130.03715.98
5.5.250.0070.02915.80
5.5.240.0100.04215.50
5.5.230.0080.04315.57
5.5.220.0130.03515.46
5.5.210.0100.03115.46
5.5.200.0080.03715.45
5.5.190.0030.04615.44
5.5.180.0030.03715.56
5.5.170.0000.01210.82
5.5.160.0050.04215.43
5.5.150.0110.03615.46
5.5.140.0060.04015.55
5.5.130.0020.04615.56
5.5.120.0120.03815.53
5.5.110.0090.04015.52
5.5.100.0070.04315.53
5.5.90.0080.03815.53
5.5.80.0090.03515.67
5.5.70.0070.04415.38
5.5.60.0110.04215.35
5.5.50.0040.03215.50
5.5.40.0070.04315.46
5.5.30.0050.04315.57
5.5.20.0100.03815.51
5.5.10.0090.04215.63
5.5.00.0080.02915.51
5.4.450.0070.02715.13
5.4.440.0050.04515.19
5.4.430.0080.04215.23
5.4.420.0130.04115.19
5.4.410.0130.03515.02
5.4.400.0090.04014.83
5.4.390.0100.03514.94
5.4.380.0060.04114.96
5.4.370.0100.03914.86
5.4.360.0120.02414.89
5.4.350.0120.04015.11
5.4.340.0100.04114.99
5.4.330.0030.00910.71
5.4.320.0050.04714.89
5.4.310.0070.02415.05
5.4.300.0070.03615.00
5.4.290.0140.03614.94
5.4.280.0050.04615.03
5.4.270.0070.03514.95
5.4.260.0090.03714.88
5.4.250.0110.03614.83
5.4.240.0070.04614.86
5.4.230.0100.03915.12
5.4.220.0090.02614.85
5.4.210.0070.02415.00
5.4.200.0080.03714.96
5.4.190.0080.03914.92
5.4.180.0150.03314.84
5.4.170.0080.04314.85
5.4.160.0090.02915.00
5.4.150.0060.02415.03
5.4.140.0110.02313.77
5.4.130.0070.03713.52
5.4.120.0100.03213.72
5.4.110.0100.03313.90
5.4.100.0110.03513.72
5.4.90.0080.03813.77
5.4.80.0030.02413.62
5.4.70.0060.02813.65
5.4.60.0070.02313.64
5.4.50.0060.02713.71
5.4.40.0030.02413.65
5.4.30.0070.02013.73
5.4.20.0060.02613.61
5.4.10.0070.02213.71
5.4.00.0070.01713.30
5.3.290.0040.03112.71
5.3.280.0090.04012.66
5.3.270.0070.02212.72
5.3.260.0070.04012.68
5.3.250.0040.02412.68
5.3.240.0010.04112.79
5.3.230.0040.03212.60
5.3.220.0100.03312.66
5.3.210.0050.03612.72
5.3.200.0040.03712.72
5.3.190.0030.03612.65
5.3.180.0050.02012.67
5.3.170.0020.02112.69
5.3.160.0030.02312.70
5.3.150.0020.02212.66
5.3.140.0120.01712.71
5.3.130.0040.02112.64
5.3.120.0100.01612.64
5.3.110.0020.03712.71
5.3.100.0000.02212.40
5.3.90.0030.02412.31
5.3.80.0070.02012.38
5.3.70.0000.02512.36
5.3.60.0120.01312.48
5.3.50.0020.02112.39
5.3.40.0040.02512.35
5.3.30.0070.03512.34
5.3.20.0030.02212.21
5.3.10.0020.02612.19
5.3.00.0040.03112.23
5.2.170.0000.02310.93
5.2.160.0020.02810.93
5.2.150.0030.02010.94
5.2.140.0000.01810.96
5.2.130.0070.01810.90
5.2.120.0020.02410.85
5.2.110.0060.01411.04
5.2.100.0030.02910.93
5.2.90.0020.02010.93
5.2.80.0030.02110.85
5.2.70.0000.01910.85
5.2.60.0020.01710.88
5.2.50.0080.01010.96
5.2.40.0070.02010.88
5.2.30.0040.01910.86
5.2.20.0040.01710.84
5.2.10.0040.01610.79
5.2.00.0060.01310.72
5.1.60.0010.02110.41
5.1.50.0000.01810.46
5.1.40.0020.02010.49
5.1.30.0020.01710.52
5.1.20.0010.01610.62
5.1.10.0020.01610.49
5.1.00.0010.01610.49
5.0.50.0040.0109.65
5.0.40.0040.0129.66
5.0.30.0010.0189.53
5.0.20.0000.0139.53
5.0.10.0010.0139.53
5.0.00.0030.0179.53
4.4.90.0000.0119.53
4.4.80.0000.0119.53
4.4.70.0010.0169.53
4.4.60.0010.0109.53
4.4.50.0000.0129.53
4.4.40.0030.0159.53
4.4.30.0010.0119.53
4.4.20.0020.0139.53
4.4.10.0020.0109.53
4.4.00.0020.0129.53
4.3.110.0020.0089.53
4.3.100.0020.0089.53
4.3.90.0000.0099.53
4.3.80.0000.0159.53
4.3.70.0010.0109.53
4.3.60.0000.0119.53
4.3.50.0030.0089.53
4.3.40.0020.0139.53
4.3.30.0010.0119.53
4.3.20.0020.0159.53
4.3.10.0030.0089.53
4.3.00.0030.0089.53

preferences:
50.85 ms | 401 KiB | 5 Q