Quote:
Originally Posted by Vaupell
Thank you it works, went back to abs
cause the math solution came up with some strange numbers..
|
My old solution before I found out about the abs function was this:
PHP Code:
function absolute_sub($i1, $i2) {
# Ensure Absolute Value after Subtraction.
if ($i1 == $i2)
return 0;
else if ($i1 > $i2)
return $i1 - $i2;
else
return $i2 - $i1;
}
Boy, did I feel stupid after I found out about abs.