byte-units-master转换字节单位的PHP库.zip

时间:2022-07-31 05:01:26
【文件属性】:

文件名称:byte-units-master转换字节单位的PHP库.zip

文件大小:25KB

文件格式:ZIP

更新时间:2022-07-31 05:01:26

类库下载-byte-units-master转换字节单位的PHP库

<?php namespace ByteUnits; class ArithmeticTest extends \PHPUnit_Framework_TestCase {     public function testAddInSameUnitSystem()     {         $this->assertEquals(Metric::bytes(10), Metric::bytes(5)->add(Metric::bytes(5)));         $this->assertEquals(Binary::bytes(10), Binary::bytes(5)->add(Binary::bytes(5)));     }     public function testRemoveInSameUnitSystem()     {         $this->assertEquals(Metric::bytes(3), Metric::bytes(5)->remove(Metric::bytes(2)));         $this->assertEquals(Binary::bytes(3), Binary::bytes(5)->remove(Binary::bytes(2)));     }     public function testAutoboxing()     {         $this->assertEquals(Metric::bytes(10), Metric::bytes(5)->add(5));         $this->assertEquals(Metric::bytes(10), Metric::bytes(5)->add('5B'));         $this->assertEquals(Metric::bytes(3), Metric::bytes(5)->remove(2));         $this->assertEquals(Metric::bytes(3), Metric::bytes(5)->remove('2B'));     }本库可以快速的帮你转换字节单位。1个字节等于8bit即1byte = 8 bit,下面是KB,MB,GB,TB的换算1KB = 1024 byte1MB = 1024KB = 1024 X 1024byte1GB = 1024MB1TB = 1024GB


【文件预览】:
byte-units-master转换字节单位的的PHP库
----php中文网下载站.url(114B)
----php中文网免费下载站.txt(219B)
----byte-units-master()
--------composer.json(647B)
--------.travis.yml(127B)
--------phpunit.xml(184B)
--------composer.lock(33KB)
--------.vimrc(3KB)
--------tests()
--------LICENSE(1KB)
--------src()
--------.gitignore(253B)
--------README.md(5KB)

网友评论