How do I calculate the percentage of a number? [closed]

I would like to calculate, in PHP, the percentage of a number. For example:

$percentage = 50;
$totalWidth = 350;

For this example, 50% of 350 = 175

How can I do that?


$percentage = 50;
$totalWidth = 350;

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

Divide $percentage by 100 and multiply to $totalWidth. Simple maths.