0

有人可以向我解释如何重构这些数学公式吗?有没有一种奇特的方法可以让 PHP 以更简洁的方式完成这一系列数学步骤?

PHP

<?php
$s = 0;

   $a = 2300; $b = 1; $c = 34.20; $d = 9.30;  $e = 0.30;

                                        $f = $a * $b;
                                        $g = $f / 100;
                                        $h = $e / 100;                        
                                        $i = $g * $h;
                                        $j = $g - $i;
                                        $k = $j * $d;
                                        $L = $i * $c;
                                        $m = $k + $L;        
                                        $s = $s + $m;  

echo $s;
?>

结果应为:215.6181并提供数字。

4

1 回答 1

1

你的意思是这样的:

  <?php
  $s = 0;

  $a = 2300; $b = 1; $c = 34.20; $d = 9.30;  $e = 0.30;

  $g = ($a * $b) / 100;                        
  $k = ($g - ($g * ($e / 100))) * $d;
  $m = $k + (($g * ($e / 100)) * $c);          
  echo $;
  ?>
于 2018-06-06T07:24:12.150 回答