https://github.com/chdemko/php-bitarray
PHP Bit Arrays
https://github.com/chdemko/php-bitarray
bitset
Last synced: 12 months ago
JSON representation
PHP Bit Arrays
- Host: GitHub
- URL: https://github.com/chdemko/php-bitarray
- Owner: chdemko
- License: bsd-3-clause
- Created: 2014-04-16T22:51:22.000Z (about 12 years ago)
- Default Branch: develop
- Last Pushed: 2024-12-17T21:16:11.000Z (over 1 year ago)
- Last Synced: 2025-06-08T21:38:02.090Z (about 1 year ago)
- Topics: bitset
- Language: PHP
- Homepage: https://php-bitarray.readthedocs.io/
- Size: 200 KB
- Stars: 11
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PHP BitArray
============
[](https://github.com/chdemko/php-bitarray/actions/workflows/php.yml)
[](https://coveralls.io/r/chdemko/php-bitarray?branch=develop)
[](https://scrutinizer-ci.com/g/chdemko/php-bitarray/?branch=develop)
[](https://codeclimate.com/github/chdemko/php-bitarray/)
[](https://www.codefactor.io/repository/github/chdemko/php-bitarray)
[](https://app.codacy.com/gh/chdemko/php-bitarray/dashboard)
[](https://packagist.org/packages/chdemko/bitarray)
[](https://packagist.org/packages/chdemko/bitarray)
[](https://packagist.org/packages/chdemko/bitarray)
[](https://packagist.org/packages/chdemko/bitarray)
[](https://raw.githubusercontent.com/chdemko/php-bitarray/develop/LICENSE)
[](https://github.com/chdemko/php-bitarray/commit/develop/)
[](http://php-bitarray.readthedocs.io/en/latest/?badge=latest)
[](http://php-bitarray.readthedocs.io/en/latest/)
[](http://php-bitarray.readthedocs.io/en/latest/)
BitArray for PHP.
This project manipulates compact array of bit values stored internally as strings.
The bit arrays may have variable length specified when an object is created using either:
* a specific size;
* a traversable collection;
* a string representation of bits;
* a json representation of bits;
* a slice from another bit array;
* a concatenation from two others bit arrays.
The project provides methods to get and set bits values using PHP natural syntax as well as the iterator facility offered by the PHP `foreach` language construct.
It also provides methods for bitwise logical operations between two bit arrays `and`, `or`, `xor` and the `not` operation.
This project uses:
* [PHP Code Sniffer](https://github.com/squizlabs/php_codesniffer) for checking PHP code style
* [PHPUnit](http://phpunit.de/) for unit test (100% covered)
* [Sphinx](https://www.sphinx-doc.org/) and [Doxygen](https://www.doxygen.nl/) for the
[documentation](http://php-sorted-collections.readthedocs.io/en/latest/?badge=latest)
Instructions
------------
Using composer: either
~~~shell
$ composer create-project chdemko/bitarray:1.2.x-dev --dev; cd bitarray
~~~
or create a `composer.json` file containing
~~~json
{
"require": {
"chdemko/bitarray": "1.2.x-dev"
}
}
~~~
and run
~~~shell
$ composer install
~~~
Create a `test.php` file containing
~~~php