如何在PHP中找到X%X的答案?

use*_*026 1 php math numbers

我有两个变量:

$percent = '3.5'; //this is the percentage
$order = 400;
//so how would i get $percent of $order?
Run Code Online (Sandbox Code Playgroud)

现在在PHP中,我如何找出400%的3.5%(我知道它的14) - 但是想知道如何使用上面的这两个变量直接在PHP中计算它.

感谢您的回复.

Exp*_*lls 6

"百分比"仅表示"每100"或"超过100"或"/ 100"

$percentOfOrder = $order * ($percent / 100);
Run Code Online (Sandbox Code Playgroud)