Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/270.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 拉威尔计算价格问题_Php_Laravel_Calculator_Price_Calculation - Fatal编程技术网

Php 拉威尔计算价格问题

Php 拉威尔计算价格问题,php,laravel,calculator,price,calculation,Php,Laravel,Calculator,Price,Calculation,我在拉维尔工作,但确实需要一些帮助。我在找打折产品的价格 “totalPrice”=>1-$request->input('折扣')*$request->input('price') (0.2是表中的折扣值) 现在上面写着1-0.2*的价格 我希望它是1-0.2*price=0.8*price你需要遵守规则 其中,您需要在(1-$request->input('discount')中包含()括号,然后将其结果相乘 就这样 'totalPrice' => ( 1 - $request->

我在拉维尔工作,但确实需要一些帮助。我在找打折产品的价格

“totalPrice”=>1-$request->input('折扣')*$request->input('price')

(0.2是表中的折扣值)

现在上面写着1-0.2*的价格

我希望它是1-0.2*price=0.8*price

你需要遵守规则

其中,您需要在
(1-$request->input('discount')
中包含
()
括号,然后将其结果相乘

就这样

'totalPrice' => ( 1 - $request->input('discount') ) * $request->input('price')

在这个等式中,系统将先进行减法运算,然后再乘以结果。

我们所有人都曾经成为白痴,但不断编码让你变得很棒!上帝保佑!