jschaedl/byte
Composer 安装命令:
composer require jschaedl/byte
包简介
byte conversion utility
关键字:
README 文档
README
A simple byte conversion utility to make conversion of byte values easier! It is built for PHP 5.3+.
Installation
Install the library using composer. Add the following to your composer.json:
"require": {
"jschaedl/byte": "dev-master"
}
And run the composer install command in terminal.
sudo composer.phar install
Usage example
<?php
$converter = new \Byte\ByteConverter();
// convert to bytes
$converter->getBytes('1b'); // 1
$converter->getBytes('1k'); // 1024
$converter->getBytes('1m'); // 1048576
$converter->getBytes('1g'); // 1073741824
// convert to kilobytes
$converter->getKBytes('1b'); // 0.0009765625
$converter->getKBytes('1k'); // 1
$converter->getKBytes('1m'); // 1024
$converter->getKBytes('1g'); // 1048576
// convert to megabytes
$converter->getMBytes('1b'); // 0.00000095367431640625
$converter->getMBytes('1k'); // 0.0009765625
$converter->getMBytes('1m'); // 1
$converter->getMBytes('1g'); // 1024
// convert to gigabytes
$converter->getGBytes('1b'); // 0.00000000093132257461548
$converter->getGBytes('1k'); // 0.00000095367431640625
$converter->getGBytes('1m'); // 0.0009765625
$converter->getGBytes('1g'); // 1
Author
License
MIT Public License
统计信息
- 总下载量: 28.42k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-10-03