bermudaphp / byte
v1.1
2024-05-20 20:55 UTC
Requires
- php: ^8.1
This package is auto-updated.
Last update: 2024-10-20 21:59:31 UTC
README
composer require bermudaphp/byte
Usage
$byte = new Byte(100*pow(1024, 2)); // or Byte::mb(100) echo $byte->to('gb', 2); // 0.1 GB or $byte->toGb(2); echo $byte->toString(); // 100 MB echo $byte->value; // 104857600 $operand = 101*1024**2; // Returns -1 if $byte->value is less than $operand. Returns 1 if $byte->value is greater than $operand. Returns 0 if $byte->value and $operand are equal $byte->compare($operand) // -1 $byte->compare('999kb') // 1 $byte->equalTo($operand) // false $byte->lessThan($operand) // true $byte->greaterThan($operand) // false ($byte = $byte->increment('100mb'))->value; // 209715200 ($byte = $byte->decrement('50mb'))->value; // 157286400 Byte::humanize($operand); // 101 MB Byte::parse('101 mb'); // 105906176