本文整理汇总了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']) {