PHPackages                             oscarpb/bitarray - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. oscarpb/bitarray

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

oscarpb/bitarray
================

A super-fast bit array in PHP

v0.2.0(4y ago)05PHP

Since Apr 26Pushed 4y ago1 watchersCompare

[ Source](https://github.com/oscarpascualbakker/bit-array)[ Packagist](https://packagist.org/packages/oscarpb/bitarray)[ RSS](/packages/oscarpb-bitarray/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (6)Used By (0)

PHP BitArray
============

[](#php-bitarray)

### A super-fast BitArray for PHP

[](#a-super-fast-bitarray-for-php)

---

This project handles super-fast arrays of bits stored internally as integers.

It is as simple as creating the bit array indicating its length. And you are not limited to one integer!

```
$bitarray = new BitArray(2129);

```

This package offers methods to get, set and unset bits, and the typical logical bitwise operators *and*, *or*, *xor* and *not* methods.

You can also fill a bit array with a string where, obviously, only 0's and 1's are allowed.

Installation
------------

[](#installation)

Using composer: either

```
$ composer require oscarpb/bitarray:0.2.0

```

or create a `composer.json` file containing

```
{
    "require": {
        "oscarpb/bitarray": "0.2.0"
    }
}
```

and run

```
$ composer install

```

Create a `test.php` file containing

```
