Compress string, then uncompress the string?

compression, function, mysql, php, string

Solution

Yes you can compress and uncompress strings in PHP (Demo):

$str = 'Hello I am a very very very very long string';
$compressed = gzcompress($str, 9);
$uncompressed = gzuncompress($compressed);

echo $str, "\n";
echo $uncompressed, "\n";
echo base64_encode($compressed), "\n";
echo bin2hex($compressed), "\n";
echo urlencode($compressed), "\n";

However MD5 is not compressing but hashing.

See as well: How to compress/decompress a long query string in PHP?

Problem

I'm working with hundreds of thousand line strings right now. Is there anyway I could compress the string to like an MD5 like, then uncompress it?

Original source

Related problems