Created
November 28, 2011 08:46
-
-
Save chluehr/1399660 to your computer and use it in GitHub Desktop.
PHP encode and compress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* by pablo at compuar dot com see http://php.net/manual/de/function.base64-encode.php | |
* | |
* | |
*/ | |
$string = 'Blah'; | |
$encoded = strtr(base64_encode(addslashes(gzcompress(serialize($string),9))), '+/=', '-_,'); | |
$string= unserialize(gzuncompress(stripslashes(base64_decode(strtr($encoded, '-_,', '+/='))))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment