PHP code example of vanni / idmix

1. Go to this page and download the library: Download vanni/idmix 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/ */

    

vanni / idmix example snippets


$out = $m->decode($str);
// $out[0] 为 TypedValue,otype=3(uint64)
echo $out[0]->val; // "18446744073709551615"(字符串,非 int)


use Vanni\Idmix\IdMix;
use Vanni\Idmix\TypedValue;

$m = IdMix::new();
$str = $m->encode(TypedValue::u16(5), TypedValue::i64(-1), TypedValue::u32(40));
$out = $m->decode($str);
// $out[0]->val === 5, $out[1]->val === -1, $out[2]->val === 40

// PHP
$m = IdMix::withAlphabet('一二三四五六七八九十');