Home  >  Article  >  Backend Development  >  php 团购折扣计算公式_php技巧

php 团购折扣计算公式_php技巧

WBOY
WBOYOriginal
2016-05-17 09:14:141085browse
复制代码 代码如下:

$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