Last active
August 29, 2015 14:10
-
-
Save m6w6/023f4fbf8008da4be0db to your computer and use it in GitHub Desktop.
http\Encoding\Stream
This file contains hidden or 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 | |
| use http\Encoding\Stream; | |
| $stream = new Stream\Deflate( | |
| Stream::FLUSH_SYNC | | |
| Stream\Deflate::TYPE_RAW ); | |
| $encoded = ""; | |
| $threshold = 500; | |
| while (strlen($encoded) < $threshold) { | |
| $encoded .= $stream->update(file_get_contents(__FILE__)); | |
| } | |
| $encoded .= $stream->finish(); | |
| var_dump(strlen($encoded), strlen(zlib_decode($encoded))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment