在PHP中扣除x%
这是一个我正在尝试做的例子。任何关于最佳实践的帮助都将非常有用在PHP中扣除x%,php,Php,这是一个我正在尝试做的例子。任何关于最佳实践的帮助都将非常有用 <?php $fullprice = "5990"; $discount = "30"; // This is 30 percentage echo = $fullprice - $discount; // Here i need to deduct 30% from the fullprice ? ?> 防白痴折扣价格计算: $fullPrice * (100 - max(0, min(100, $disc
<?php
$fullprice = "5990";
$discount = "30"; // This is 30 percentage
echo = $fullprice - $discount; // Here i need to deduct 30% from the fullprice ?
?>
防白痴折扣价格计算:
$fullPrice * (100 - max(0, min(100, $discount))) / 100;
它压扁0到100之间的折扣百分比。echo$finalPrice=$fullprice-($discount*$fullprice/100);这可能会有帮助:基本数学…?
echo=…
=语法错误:)@Jack:ahhh。。复制/粘贴而不检查。谢谢
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;