任何人都可以编写PHP脚本作为计算器来计算增加和减少的百分比吗?
http://www.marshu.com/articles/calculate-percentage-increase-decrease-percent-calculator.php
谢谢。
答案 0 :(得分:1)
如果您打开该页面的来源,您将找到以下内容:
function PercentIncrease(form) {
var num1 = form.num1.value;
var num2 = form.num2.value;
return ((num2 - num1) / num1 * 100 + "%");
}
如果您遇到PHP语法问题,请告诉我们。
更新:显然你有,所以:
function PercentIncrease($num1, $num2) {
return (($num2 - $num1) / $num1 * 100 . "%");
}
$n1 = 10;
$n2 = 200;
echo PercentIncrease($n1, $n2); //output 1900%
echo PercentIncrease($n2, $n1); //output -95%
答案 1 :(得分:0)
您可以制作如下功能:
select ResourceID
from TableName
where ResourceID not in (SELECT ResourceID
from TableName
group by ResourceID, IsActive
having IsActive = 1)