javascript - Questions about calculating the total price of different products
女神的闺蜜爱上我
女神的闺蜜爱上我 2017-06-08 11:02:08
0
4
910

Now there are different products with different calculation formulas, such as product A, the calculation formula is: quantity X duration X unit price. Product B: unit price * quantity.
Please store the calculation formula and match it by yourself.

女神的闺蜜爱上我
女神的闺蜜爱上我

reply all(4)
刘奇
    $math = '%s*%s';
    $str  = sprintf($math, 5, 6);
    $result=eval("return $str;");
    var_dump($result);
typecho

Give each product a flag directly, and then save the company in turn. When matching, you only need to match the flag to find the formula.

淡淡烟草味

Constructor, determines the execution content based on the parameters passed in

扔个三星炸死你
select 商品A "商品名", 数量X时长X单价 "总计"
from table
where 商品=商品A
union all
select 商品B "商品名", 数量X单价 "总计"
from table
where 商品=商品B

If it is product A

select 商品B "商品名", 数量X单价 "总计"
from table
where 商品=商品B

No result will be returned

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!