public static function typeBytes($type, $type_len)
    {
        $optional_int = "";

        if ($type_len < 15) {
            $type .= sprintf("%x", $type_len);
        } else {
            $type .= "f";
            $optional_int = self::intBytes($type_len);
        }

        return pack("H*", $type).$optional_int;
    }