Calculating a percentage with the result of a subtraction
Posted: Thu Apr 03, 2008 12:46 pm
Okie....
I have $variable1, $variable2 and $variable3.
My question is how to get $variable3 to show the percentage of the result of $variable2 - $variable1.
The values for $variable1 and $variable2 are going to be submitted via a form by the user and the result of the subtraction should be a % that will be assigned to $variable3. The percentage can be positive or negative.
For example:
$variable1 = 11.54
$variable2 = 10.45
$variable3 = -9.45%
Any help is appreciated.
FayeC
I have $variable1, $variable2 and $variable3.
My question is how to get $variable3 to show the percentage of the result of $variable2 - $variable1.
The values for $variable1 and $variable2 are going to be submitted via a form by the user and the result of the subtraction should be a % that will be assigned to $variable3. The percentage can be positive or negative.
For example:
$variable1 = 11.54
$variable2 = 10.45
$variable3 = -9.45%
Any help is appreciated.
FayeC