Fix #71505: Missing documentation about deflate_init() etc.

Add the example.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@339760 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Christoph Michael Becker 2016-08-01 15:53:54 +00:00
parent 5f177879f0
commit e47d027b6e

View file

@ -49,6 +49,30 @@ echo "</pre>\n</body>\n</html>\n";
]]>
</programlisting>
</example>
<example>
<title>Working with the incremental compression and decompression API as of PHP 7.0.0</title>
<programlisting role="php">
<![CDATA[
// Perform GZIP compression:
$deflateContext = deflate_init(ZLIB_ENCODING_GZIP);
$compressed = deflate_add($deflateContext, "Data to compress", ZLIB_NO_FLUSH);
$compressed .= deflate_add($deflateContext, ", more data", ZLIB_NO_FLUSH);
$compressed .= deflate_add($deflateContext, ", and even more data!", ZLIB_FINISH);?>
// Perform GZIP decompression:
$inflateContext = inflate_init(ZLIB_ENCODING_GZIP);
$uncompressed = inflate_add($inflateContext, $compressed, ZLIB_NO_FLUSH);
$uncompressed .= inflate_add($inflateContext, NULL, ZLIB_FINISH);
echo $uncompressed;
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Data to compress, more data, and even more data!
]]>
</screen>
</example>
</chapter>
<!-- Keep this comment at the end of the file