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?
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?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With