これが私がやろうとしていることの例です。ここでのベストプラクティスに関するヘルプは非常に役立ちます!
<?php
$fullprice = "5990";
$discount = "30"; // This is 30 percentage
echo = $fullprice - $discount; // Here i need to deduct 30% from the fullprice ?
?>
これが私がやろうとしていることの例です。ここでのベストプラクティスに関するヘルプは非常に役立ちます!
<?php
$fullprice = "5990";
$discount = "30"; // This is 30 percentage
echo = $fullprice - $discount; // Here i need to deduct 30% from the fullprice ?
?>
echo $fullprice * ((100 - $discount) / 100);
$fullprice = 5990;
$discount = 30; // This is 30 percentage
echo $fullprice * ((100 - $discount) / 100);
ばか証明割引価格の計算:
$fullPrice * (100 - max(0, min(100, $discount))) / 100;
これは、0から100までの割引率を押しつぶします。
echo $fullprice * (1 - $discount/100);