1. Go to this page and download the library: Download blockchainethdev/rlp 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/ */
blockchainethdev / rlp example snippets
use Blockchainethdev\RLP\RLP;
$rlp = new RLP;
// c483646f67
$encoded = $rlp->encode(['dog']);
// 83646f67
$encoded = $rlp->encode('dog');
use Blockchainethdev\RLP\RLP;
use Blockchainethdev\RLP\Types\Str;
$rlp = new RLP;
$encoded = $rlp->encode(['dog']);
// only accept 0x prefixed hex string
$decoded = $rlp->decode('0x' . $encoded);
// show 646f67
echo $decoded[0];
// show dog
echo hex2bin($decoded[0]);
// or you can
echo Str::decodeHex($decoded[0]);
use Blockchainethdev\RLP\RLP;
$rlp = new RLP;
$encoded = $rlp->encode(['blockchainethdev', 'ethereum', 'solidity']);
use Blockchainethdev\RLP\RLP;
use Blockchainethdev\RLP\Types\Str;
$rlp = new RLP;
$encoded = $rlp->encode(['blockchainethdev', 'ethereum', 'solidity']);
$decoded = $rlp->decode('0x' . $encoded);
// echo blockchainethdev
echo hex2bin($decoded[0]);
// echo ethereum
echo hex2bin($decoded[1]);
// echo solidity
echo hex2bin($decoded[2]);
// or you can
echo Str::decodeHex($decoded[0]);
echo Str::decodeHex($decoded[1]);
echo Str::decodeHex($decoded[2]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.