I've got a problem, it's more i maths question i guess but i have a target % as a float in my database say 80.00 and a result float say 65.14, what I want to know is what the % variance is - how the heck does one do that?
Something like this?
$target = 80; $actual = 65.14; $variance_pct = (($actual - $target) / $target) * 100; echo round($variance_pct, 2) . "%"; // -18.58%