I have the following code that rounds my amounts to the nearest Dollar:
switch ($amazonResult['SalesRank']) {
case ($amazonResult['SalesRank'] < 1 || trim($amazonResult['SalesRank'])===''|| !isset($amazonResult['SalesRank']) || $amazonResult['SalesRank']=== null):
$Price=((float) $lowestAmazonPrice) * 0.05;
$payPrice = round($Price, 0); //to round the price up or down to the nearest $
break;
case ($amazonResult['SalesRank'] > 0 && $amazonResult['SalesRank'] <= 15000):
$Price=((float) $lowestAmazonPrice) * 0.20;
$payPrice = round($Price, 0); //to round the price up or down to the nearest $
break;
I understand that if I use round($Price, 2); that I will have 2 decimal places, but is there a way to round to the nearest 50 cents?