本文整理匯總了PHP中CommonFunctions::formatSiUnitPrefix方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommonFunctions::formatSiUnitPrefix方法的具體用法?PHP CommonFunctions::formatSiUnitPrefix怎麽用?PHP CommonFunctions::formatSiUnitPrefix使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CommonFunctions
的用法示例。
在下文中一共展示了CommonFunctions::formatSiUnitPrefix方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: add_si_unit
function add_si_unit($number)
{
return CommonFunctions::formatSiUnitPrefix($number);
}
示例2: testFormatSiUnitPrefix
/**
* Test method for formatSiUnitPrefix()
*/
public function testFormatSiUnitPrefix()
{
// No Unit prefix
$this->assertEquals("100", CommonFunctions::formatSiUnitPrefix(100), CommonFunctions::formatSiUnitPrefix(100));
$this->assertEquals(152, CommonFunctions::formatSiUnitPrefix(152));
$this->assertEquals(94, CommonFunctions::formatSiUnitPrefix(94));
// kilo
$this->assertEquals("1 k", CommonFunctions::formatSiUnitPrefix(1000));
$this->assertEquals("1.52 k", CommonFunctions::formatSiUnitPrefix(1520));
$this->assertEquals("1.52 k", CommonFunctions::formatSiUnitPrefix(1523));
// Mega
$this->assertEquals("1 M", CommonFunctions::formatSiUnitPrefix(1000000));
$this->assertEquals("1.53 M", CommonFunctions::formatSiUnitPrefix(1530000));
$this->assertEquals("1.53 M", CommonFunctions::formatSiUnitPrefix(1525000));
$this->assertEquals("1.54 M", CommonFunctions::formatSiUnitPrefix(1536750));
// Giga
$this->assertEquals("1 G", CommonFunctions::formatSiUnitPrefix(1000000000));
$this->assertEquals("1.93 G", CommonFunctions::formatSiUnitPrefix(1930000000));
$this->assertEquals("1.54 G", CommonFunctions::formatSiUnitPrefix(1542000000));
$this->assertEquals("1.55 G", CommonFunctions::formatSiUnitPrefix(1546000000));
//Tera
$this->assertEquals("1 T", CommonFunctions::formatSiUnitPrefix(1000000000000));
$this->assertEquals("1.45 T", CommonFunctions::formatSiUnitPrefix(1450000000000));
$this->assertEquals("1.52 T", CommonFunctions::formatSiUnitPrefix(1523000000000));
$this->assertEquals("1.53 T", CommonFunctions::formatSiUnitPrefix(1525000000000));
}
示例3:
<td><a href="#" title="<?php
echo $rset[$c][2];
?>
" onmousedown="viewAttach('<?php
echo $rset[$c][1];
?>
')" ><?php
echo $rset[$c][3];
?>
</a></td>
<td><?php
echo $rset[$c][2];
?>
</td>
<td><?php
echo CommonFunctions::formatSiUnitPrefix($rset[$c][4]);
?>
B</td>
<td><?php
echo $rset[$c][6];
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
} else {
if (!$locRights['add']) {