Download the PHP package calabrothers/php-ds-bitmask without Composer

On this page you can find all versions of the php package calabrothers/php-ds-bitmask. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-ds-bitmask

PHP Bitmask Support

Build Status Coverage Status Total Downloads License -->

A class to support bitmask operations.

Install

composer require calabrothers/php-ds-bitmask

Test

composer install
composer test

HowTo

Building an object is done via constructor or factory function:

$X = new Bitmask(3);       // 000...0011
$Y = Bitmask::create(5);   // 000...0101

Available functions:

Let us consider the classic three logical operators:

Operator Notation
AND(a,b) ![AND](https://latex.codecogs.com/gif.latex?a%20%5Cwedge%20b)
OR(a,b) ![OR](https://latex.codecogs.com/gif.latex?a%20%5Cvee%20b)
NOT(a) ![NOT](https://latex.codecogs.com/gif.latex?%5Cbar%20a)

Then the basic Bitmask object will provide the following operators:

PHP Command Bitwise Operation
$x->setValue($v) ![SetValue](https://latex.codecogs.com/gif.latex?x%20%3D%20v)
$x->setBit($b) ![SetBit](https://latex.codecogs.com/gif.latex?x%20%3D%20x%20%5Cvee%202%5Eb)
$x->clearBit($b) ![ClearBit](https://latex.codecogs.com/gif.latex?x%20%3D%20x%20%5Cwedge%20%5Cbar%7B2%5Eb%7D)
$x->checkBit($b) ![CheckBit](https://latex.codecogs.com/gif.latex?%28x%20%5Cwedge%202%5Eb%29%20%3E%200)
$x->setMask($m) ![SetMask](https://latex.codecogs.com/gif.latex?x%20%3D%20x%20%5Cvee%20m)
$x->clearMask($m) ![ClearMask](https://latex.codecogs.com/gif.latex?x%20%3D%20x%20%5Cwedge%20%5Cbar%7Bm%7D)
$x->checkMask($m) ![CheckMask](https://latex.codecogs.com/gif.latex?%28x%20%5Cwedge%20m%29%20%3E%200)
$x->not() ![NotFcn](https://latex.codecogs.com/gif.latex?y%20%3D%20%5Cbar%7Bx%7D)
$x->or($y) ![OrFcn](https://latex.codecogs.com/gif.latex?z%20%3D%20x%20%5Cvee%20y)
$x->and($y) ![AndFcn](https://latex.codecogs.com/gif.latex?z%20%3D%20x%20%5Cwedge%20y)

Example

$X = new Bitmask(3);  
echo $X;                                // Bitmask(64|62|2) [ 0000 0011 ]

$Y = Bitmask::create(5);    
echo $Y;                                // Bitmask(64|61|3) [ 0000 0101 ]

// Return new object
echo $X->and($Y);                       // Bitmask(64|61|3) [ 0000 0101 ]       
echo $X->and($Y);                       // Bitmask(64|61|3) [ 0000 0111 ]

// Alter the object
echo $X->clearBit(0);                   // Bitmask(64|62|2) [ 0000 0010 ]
echo $X->setBit(4);                     // Bitmask(64|59|5) [ 0001 0010 ]

// Check bit (convention starts from 0)
echo $X->checkBit(2) ? "true":"false";  // false
echo $X->checkBit(4) ? "true":"false";  // true

Credits

Support quality code

Foo

License

The MIT License (MIT). Please see LICENSE for more information.


All versions of php-ds-bitmask with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package calabrothers/php-ds-bitmask contains the following files

Loading the files please wait ....