nikeee/bit-array

A bit array implementation for PHP

v0.2.0 2022-06-22 18:17 UTC

This package is auto-updated.

Last update: 2024-05-01 22:38:16 UTC


README

A bit-array implementation for PHP. Compatible with the BitArray of ts-ds.

Depending on the extensions that are available, GMP is used under the hood for faster bit operations.

Installation

composer require nikeee/bit-array

Usage

<?php
require_once 'vendor/autoload.php';

use Nikeee\BitArray\BitArray;

$arr = BitArray::create(8);

$arr->set(1, true)
    ->set(2, true)
    ->set(4, true);

$arr->applyBitwiseNot();

echo "Bits: " . $arr->toBitString() . "\n";