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;
}
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.