mitsuru793 / bit
Bit Class which is Value Object.
v0.0.1
2020-02-10 18:38 UTC
Requires
- php: >=7.4
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- phpstan/phpstan: ^0.12.9
- phpunit/phpunit: ^9.0
- symfony/var-dumper: ^5.0
This package is auto-updated.
Last update: 2025-04-06 19:09:51 UTC
README
PHP Bit
// construct $bit = new UnlimitedBit(2); $bit = new UnlimitedBit('0010'); assert($bit->asInt() === 2); assert($bit->asSTr() === '10'); // immutable assert($bit->on(4)->asStr() === '1010'); assert($bit->asStr() === '10'); assert($bit->on(4)->off(2)->asStr() === '1000');
Both of the followings implement interface 'Bit'. Please see test codes and interface.
- UnlimitedBit
- LimitedBit