ho il seguente codice che arrotonda i miei ammonta al dollaro più vicino:arrotondamento al più vicino 50 centesimi
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;
ho capito che se uso round ($ prezzo, 2); che avrò 2 cifre decimali, ma c'è un modo per arrotondare ai 50 cent più vicini?
Grazie, che ha fatto il trucco. – Jim