Location: PHPKode > projects > ZorbIPTraffic > zorbiptraffic/zorbiptraffic/zorblib.php
<?PHP
// 1st Parameter = Number to convert
// 2nd Parameter = Number of Dec. places
// 3rd Parameter = 0 Number+Extension. Ex: "1.23 GB"
// 3rd Parameter = 1 Number Alone. Ex: "1.23"
// 3rd Parameter = 2 Extension Alone.  Ex: "GB"
function fncScale($intNumber, $intDem, $intReturn)
 {
  $arrFormat = array("B","Kb","Mb","Gb","Tb");
  for ($i = 0; $i < sizeof($arrFormat); $i++)
  {
     if (($intNumber / 1024 < 1) | (sizeof($arrFormat) == $i+1))
        {
        if ($intReturn==0)
	    if (($intDem==0) && ($intNumber<10) && ($intNumber!=0))
	    {  return number_format($intNumber,1,'.','') ." $arrFormat[$i]";}
	    else
	    {  return number_format($intNumber,$intDem,'.','') ." $arrFormat[$i]";}
        elseif ($intReturn == 1)
          
	    if (($intDem==0) && ($intNumber<10) && ($intNumber!=0))
	    {  return number_format($intNumber,1,'.','');}
	    else
	    {  return number_format($intNumber,$intDem,'.','');}

        elseif ($intReturn == 2)
          return "$arrFormat[$i]";
         break;
        }
      else
      {
         $intNumber = $intNumber / 1024;
      }
  }
}																																																								
?>
Return current item: ZorbIPTraffic