Skip to content

Instantly share code, notes, and snippets.

@m6w6
Last active August 29, 2015 14:10
Show Gist options
  • Select an option

  • Save m6w6/023f4fbf8008da4be0db to your computer and use it in GitHub Desktop.

Select an option

Save m6w6/023f4fbf8008da4be0db to your computer and use it in GitHub Desktop.
http\Encoding\Stream
<?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