Changeset View
Changeset View
Standalone View
Standalone View
src/utils/viewutils.php
Show First 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | function phutil_format_units_generic( | ||||
} | } | ||||
$remainder = 0; | $remainder = 0; | ||||
$accum = 1; | $accum = 1; | ||||
$scale = array_shift($scales); | $scale = array_shift($scales); | ||||
$label = array_shift($labels); | $label = array_shift($labels); | ||||
while ($n >= $scale && count($labels)) { | while ($n >= $scale && count($labels)) { | ||||
$remainder += ($n % $scale) * $accum; | $remainder += ((int)$n % $scale) * $accum; | ||||
$n /= $scale; | $n /= $scale; | ||||
$accum *= $scale; | $accum *= $scale; | ||||
$label = array_shift($labels); | $label = array_shift($labels); | ||||
if (!count($scales)) { | if (!count($scales)) { | ||||
break; | break; | ||||
} | } | ||||
$scale = array_shift($scales); | $scale = array_shift($scales); | ||||
} | } | ||||
Show All 18 Lines |