Home  >  Article  >  php教程  >  php 团购折扣计算公式

php 团购折扣计算公式

WBOY
WBOYOriginal
2016-06-13 12:04:221586browse

复制代码 代码如下:


$price=$row['price']; //原价
$nowprice=$row['nowprice']; //现价
$jiesheng=$price-$nowprice; //节省金额
//$discount折扣计算
if ( $nowprice > 0 )
{
$discount = round(10 / ($price / $nowprice), 1);
}
else
{
$discount = 0;
}
if ( $discount



完整代码:

复制代码 代码如下:






Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn