It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center




已关闭8年。




我想用PHP计算一个数字的百分比。例如:
$percentage = 50;
$totalWidth = 350;

对于此示例,350的50%= 175

我怎样才能做到这一点?

最佳答案

$percentage = 50;
$totalWidth = 350;

$new_width = ($percentage / 100) * $totalWidth;

10-07 21:20