PHP code example of mitsuru793 / bit
1. Go to this page and download the library: Download mitsuru793/bit library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mitsuru793 / bit example snippets
// 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');