nikeee/bit-array

A bit array implementation for PHP

Installs: 11

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

pkg:composer/nikeee/bit-array

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

This package is auto-updated.

Last update: 2025-10-01 22:43:00 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";