Well, here's what I want to do.
I have 2 variables (to start), and I want to find the numerical difference between the two. The easiest way I know of doing it is subtracting one from the other.
The problem is, let's say $a equals 10 and $b equals 5.
$a - $b = 5 // this is what I want to happen
The problem is of course that I have no idea, at program time, which variable is going to be larger. So if $a is the one that equals 5, and $b is the one that equals 10, I'm going to end up with -5.
So, my first question is, how do I remove the negative from a number?
One way I know of:
if ($c < 0) {
$c = $c - $c - $c;
}
Thus -5 turns into "5". Is that the most efficient way of doing it, or am I missing a basic piece here?
While this is perfectly fine for something like addition or subtraction, multiplication/division/modulus/exponents make this whole scenario far more difficult.
Another question, is it there a simpler way of telling the difference between two variables, in a numerical sense?