PHPDaemon\Utils\Binary::LV PHP Method

LV() public static method

Build length-value binary snippet
public static LV ( string $str, integer $len = 1, boolean $lrev = false ) : string
$str string Data
$len integer Number of bytes to encode length. Default is 1
$lrev boolean Reverse?
return string
    public static function LV($str, $len = 1, $lrev = false)
    {
        $l = static::i2b($len, mb_orig_strlen($str));
        if ($lrev) {
            $l = strrev($l);
        }
        return $l . $str;
    }