Re: Finding a percentage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Daniel Anderson wrote:
Does anyone know how to find the progress percentage (%) between one number to the next?

For example:

I have a minimal number of 0
I have a maximum number of 77
I have a current number of 9

Does anyone know how I may find the percentage of this number from the minimal number, to the maximum number?

EXAMPLE:

The Mininimum Number is 0, the Maximum Number is 50, the Current Number is 25. This would mean the percentage of this would be 50%. It's that "progress" output I'm looking to obtaining.

Unfortunately I cannot work with whole multiples of ten (10, 50, 100), I am limited to erratic number placements.

This is very urgent, please, does anyone know a solution?

This has so little to do with PHP I dunno where to start. However, I am in an oddly good mood right now, so...

$percentage = (($max - $min) / 100) * $current;

I haven't checked but I'm fairly sure a Google for "calculate percentage" would give you the answer.

-Stut

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux