1. Go to this page and download the library: Download titasgailius/php-bits library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
titasgailius / php-bits example snippets
HPBits\Bits;
/**
* Convert string to a binary string
*
* Bits::strbin(string $string) : string
*/
Bits::strbin('Hello'); // "0100100001100101011011000110110001101111"
/**
* Converts string to a decimal number representation
*
* Bits::strdec(string $string) : int
*/
Bits::strdec('Hello'); // 310939249775
/**
* Converts an integer to a binary string
*
* Bits::decbin(int $integer, int $length = 8) : string
*/
Bits::decbin(10); // 00001010
Bits::decbin(10, 16); // 0000000000001010
/**
* Get count of bits in a string
*
* Bits::strlen(string $string) : int
*
*/
Bits::strlen('Hello'); // 40
/**
* Rotate integer's bits to left by 1 position and return new integer
* Bits::decRotateLeft(int $integer, int $positions = 1) : int
*/
Bits::decRotateLeft(10);
// 20, because 10 is "00010100" in binary so rotated it's "00010100" which is 20.
$ composer install titasgailius/php-bits
{
" "titasgailius/php-bits": "~1.00"
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.