Home >Backend Development >PHP Tutorial >User-Agent string code for simple compression of English strings implemented in PHP

User-Agent string code for simple compression of English strings implemented in PHP

WBOY
WBOYOriginal
2016-07-29 08:37:59843browse

PHP, suitable for posting simple encrypted ciphertext

Copy code The code is as follows:


//replacement encrypted replacement from the previous version
function compress_func($match) {return strlen($match[0]).$match[0]{0};}
function uncompress_func($match) {return str_repeat($match[2], $match[1]);}
function compress($str ) {
                                                                                                           /"); (d+) (w)/"," uncompress_func ", $ Str ; i, s ) If(substr( str, i, 1) == s) l++;
else {
if(s != "") {
if(l > 1) str_out=str_out""l
            str_out=str_out""s;                                                    s = substr(str, i, 1);
l = 1;
}
}
return str_out;
}

function uncompress(str, _ARGVEND_, str_out, str_len, i, c) {
str_out = "";
str_len = length(str);

for(i =1; i <= str_len; i++) { c = 0; while(substr(str, i, 1)~/[0-9]/) { c = c*10+substr(str, i, 1);                                                                                                  str, i, 1);

}

return str_out;
}


The above introduces the code for simple compression of English strings implemented by User-Agent string PHP, including the content of User-Agent string. I hope it will be helpful to friends who are interested in PHP tutorials.


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn