Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

php

percentage

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?

like image 232
John Smeuth Avatar asked Apr 18 '12 00:04

John Smeuth


People also ask

How do you calculate percentage closure?

To calculate your close rate, add the total amount of deals made in a month and divide that amount by the number of leads in your pipeline during that time. Multiply that number by 100 to calculate your close rate percentage.

What is a close percentage?

Your close ratio represents the number of sales you made compared to the number of quotes you gave to qualified prospects. To calculate this number, divide the number of sales you made by the number of quotes you sent out. If you wrote 100 quotes and made 30 sales, then your closing ratio is 30 percent.

What is the formula to find the percentage of a number?

If we have to calculate percent of a number, divide the number by the whole and multiply by 100. Hence, the percentage means, a part per hundred. The word per cent means per 100. It is represented by the symbol “%”.


2 Answers

$percentage = 50; $totalWidth = 350;  $new_width = ($percentage / 100) * $totalWidth; 
like image 122
pogeybait Avatar answered Oct 19 '22 06:10

pogeybait


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

like image 39
hkf Avatar answered Oct 19 '22 06:10

hkf