PHP code example of perlamutr / php-rdb-parser
1. Go to this page and download the library: Download perlamutr/php-rdb-parser 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/ */
perlamutr / php-rdb-parser example snippets
use Perlamutr\Reader\ReaderFile;
use Perlamutr\Parser;
$reader = new ReaderFile('filename.rdb');
$parser = new Parser($reader);
$generator = $parser->parseRDB();
foreach ($generator as $key => $value) {
if (is_object($key)) {
// if parser meets command it returns $key as object of type Command
continue;
}
// Otherwise it contains the key
echo "Key = '$key'\n";
// And value is a Generator with key-value pairs (or single value)
foreach ($value as $k => $v) {
echo "\t$k => $v\n";
}
}
use Perlamutr\Reader\ReaderFile;
use Perlamutr\Parser;
$reader = new ReaderFile('filename.rdb');
$parser = new Parser($reader);
$parser->setSkipData(true);
$generator = $parser->parseRDB();
foreach ($generator as $key => $value) {
// $key is always string with key name
echo "Key = '$key'\tType = '{$value['type']}\tBytes = '{$value['skip']}'\tPosition = '{$value['position']}'\n";
}
bash
composer