php-windows Digest 31 May 2006 13:15:04 -0000 Issue 2973
Topics (messages 26938 through 26940):
Re: Finding a percentage
26938 by: Stut
26939 by: Luis Moreira
26940 by: John Harris
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
This is not exactly a PHP issue, it is straight math !!!
Percent = value / (max - min)
-----Original Message-----
From: Daniel Anderson [mailto:[EMAIL PROTECTED]
Sent: terça-feira, 30 de Maio de 2006 23:11
To: [email protected]
Subject: [PHP-WIN] Finding a percentage
Hi,
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?
Many thanks!
Dan
--- End Message ---
--- Begin Message ---
On 31 May 2006 at 9:09, Luis Moreira wrote:
> This is not exactly a PHP issue, it is straight math !!!
>
> Percent = value / (max - min)
Don't forget to range the value (if unlike the original question, the
minimum is not zero) and multiply by 100.
Percent = ( (value - min) / (max - min) ) * 100
--- End Message ---