This function will calculate the difference in % between X and Y. X must be less then Y.
function CalcDiffPer($n1, $n2)
{
if ($n2 < $n1) list($n1, $n2) = array($n2, $n1);
return sprintf('%.1f', (100 - ( ($n1 / $n2) * 100))).'%';
}
echo CalcDiffPer(75,100);
VN:F [1.9.13_1145]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.13_1145]
» Latest comments