How do I calculate the percentage of a number?
$percentage = 50;
$totalWidth = 350;
$new_width = ($percentage / 100) * $totalWidth;
Divide $percentage
by 100 and multiply to $totalWidth
. Simple maths.
$percentage = 50;
$totalWidth = 350;
$new_width = ($percentage / 100) * $totalWidth;
Divide $percentage
by 100 and multiply to $totalWidth
. Simple maths.