我想用PHP计算一个数字的百分比.例如:
$percentage = 50;
$totalWidth = 350;
Run Code Online (Sandbox Code Playgroud)
对于此示例,350%的50%= 175
我怎样才能做到这一点?
pog*_*ait 124
$percentage = 50;
$totalWidth = 350;
$new_width = ($percentage / 100) * $totalWidth;
Run Code Online (Sandbox Code Playgroud)
hkf*_*hkf 18
除以$percentage100并乘以$totalWidth.简单的数学.
| 归档时间: |
|
| 查看次数: |
190468 次 |
| 最近记录: |