1. Go to this page and download the library: Download thesis/varint 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/ */
thesis / varint example snippets
use Thesis\Varint;
use BcMath\Number;
$codec = Varint\BcMath::Codec;
$buffer = $codec->encodeVarint(new Number('125'));
echo $codec->decodeVarint($buffer)->value; // '125'
use Thesis\Varint;
use BcMath\Number;
$codec = Varint\BcMath::Codec;
$buffer = $codec->encodeVarint($codec->encodeZigZag(new Number('-125')));
echo $codec->decodeZigZag($codec->decodeVarint($buffer))->value; // '-125'
use Thesis\Varint;
use BcMath\Number;
$codec = Varint\BcMath::Codec;
echo $codec->size(new Number('128')); // 2
use Thesis\Varint;
use BcMath\Number;
$codec = Varint\BcMath::Codec;
$sized = $codec->decodeVarintSized($codec->encodeVarint(new Number('128')));
echo $sized->value; // '128'
echo $sized->size; // 2
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.